cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1071777 - in /cassandra/branches/cassandra-0.6: CHANGES.txt src/java/org/apache/cassandra/db/CompactionManager.java
Date Thu, 17 Feb 2011 20:46:52 GMT
Author: jbellis
Date: Thu Feb 17 20:46:51 2011
New Revision: 1071777

URL: http://svn.apache.org/viewvc?rev=1071777&view=rev
Log:
make key cache preheating default to false
patch by jbellis; reviewed by brandonwilliams for CASSANDRA-2175

Modified:
    cassandra/branches/cassandra-0.6/CHANGES.txt
    cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/db/CompactionManager.java

Modified: cassandra/branches/cassandra-0.6/CHANGES.txt
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.6/CHANGES.txt?rev=1071777&r1=1071776&r2=1071777&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.6/CHANGES.txt (original)
+++ cassandra/branches/cassandra-0.6/CHANGES.txt Thu Feb 17 20:46:51 2011
@@ -4,6 +4,8 @@
  * update commitlog replay to catch bogus RowMutation lengths caused
    by unclean shutdown (CASSANDRA-2128)
  * add -Dhinted_handoff_throttle option (CASSANDRA-2161)
+ * make key cache preheating default to false; enable with
+   -Dcompaction_preheat_key_cache=true (CASSANDRA-2175)
 
 
 0.6.11

Modified: cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/db/CompactionManager.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/db/CompactionManager.java?rev=1071777&r1=1071776&r2=1071777&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/db/CompactionManager.java
(original)
+++ cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/db/CompactionManager.java
Thu Feb 17 20:46:51 2011
@@ -282,6 +282,7 @@ public class CompactionManager implement
         executor.beginCompaction(cfs, ci);
 
         Map<DecoratedKey, SSTable.PositionSize> cachedKeys = new HashMap<DecoratedKey,
SSTable.PositionSize>();
+        boolean preheatKeyCache = Boolean.getBoolean("compaction_preheat_key_cache");
 
         try
         {
@@ -309,12 +310,15 @@ public class CompactionManager implement
                     logger.warn("Large row " + row.key.key + " in " + cfs.getColumnFamilyName()
+ " " + rowsize + " bytes");
                 cfs.addToCompactedRowStats(rowsize);
 
-                for (SSTableReader sstable : sstables)
+                if (preheatKeyCache)
                 {
-                    if (sstable.getCachedPosition(row.key) != null)
+                    for (SSTableReader sstable : sstables)
                     {
-                        cachedKeys.put(row.key, new SSTable.PositionSize(prevpos, rowsize));
-                        break;
+                        if (sstable.getCachedPosition(row.key) != null)
+                        {
+                            cachedKeys.put(row.key, new SSTable.PositionSize(prevpos, rowsize));
+                            break;
+                        }
                     }
                 }
             }
@@ -326,7 +330,7 @@ public class CompactionManager implement
 
         SSTableReader ssTable = writer.closeAndOpenReader();
         cfs.replaceCompactedSSTables(sstables, Arrays.asList(ssTable));
-        for (Entry<DecoratedKey, SSTable.PositionSize> entry : cachedKeys.entrySet())
+        for (Entry<DecoratedKey, SSTable.PositionSize> entry : cachedKeys.entrySet())
// empty if preheat is off
             ssTable.cacheKey(entry.getKey(), entry.getValue());
         submitMinorIfNeeded(cfs);
 



Mime
View raw message