You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by jb...@apache.org on 2012/02/16 16:27:16 UTC

[3/5] git commit: avoid unproductive deserializing of cached rows during compaction patch by jbellis for CASSANDRA-3921

avoid unproductive deserializing of cached rows during compaction
patch by jbellis for CASSANDRA-3921


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/94860c6c
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/94860c6c
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/94860c6c

Branch: refs/heads/trunk
Commit: 94860c6c3713cda4f17dabb2ac2ce30cfe92f6e2
Parents: 78142cb
Author: Jonathan Ellis <jb...@apache.org>
Authored: Thu Feb 16 09:26:16 2012 -0600
Committer: Jonathan Ellis <jb...@apache.org>
Committed: Thu Feb 16 09:26:38 2012 -0600

----------------------------------------------------------------------
 CHANGES.txt                                        |    5 +++++
 .../db/compaction/CompactionController.java        |    8 ++++++++
 2 files changed, 13 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/94860c6c/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 6786c9d..069c1e3 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,3 +1,8 @@
+1.1-dev
+ * avoid unproductive deserializing of cached rows during compaction
+   (CASSANDRA-3921)
+
+
 1.1-beta1
  * add nodetool rebuild_index (CASSANDRA-3583)
  * add nodetool rangekeysample (CASSANDRA-2917)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/94860c6c/src/java/org/apache/cassandra/db/compaction/CompactionController.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/compaction/CompactionController.java b/src/java/org/apache/cassandra/db/compaction/CompactionController.java
index 4d1e36f..7db5723 100644
--- a/src/java/org/apache/cassandra/db/compaction/CompactionController.java
+++ b/src/java/org/apache/cassandra/db/compaction/CompactionController.java
@@ -31,6 +31,7 @@ import org.apache.cassandra.db.DecoratedKey;
 import org.apache.cassandra.db.EchoedRow;
 import org.apache.cassandra.io.sstable.SSTableIdentityIterator;
 import org.apache.cassandra.io.sstable.SSTableReader;
+import org.apache.cassandra.service.CacheService;
 
 /**
  * Manage compaction options.
@@ -100,6 +101,13 @@ public class CompactionController
 
     public void removeDeletedInCache(DecoratedKey key)
     {
+        // For the copying cache, we'd need to re-serialize the updated cachedRow, which would be racy
+        // vs other updates.  We'll just ignore it instead, since the next update to this row will invalidate it
+        // anyway, so the odds of a "tombstones consuming memory indefinitely" problem are minimal.
+        // See https://issues.apache.org/jira/browse/CASSANDRA-3921 for more discussion.
+        if (CacheService.instance.rowCache.isPutCopying())
+            return;
+
         ColumnFamily cachedRow = cfs.getRawCachedRow(key);
         if (cachedRow != null)
             ColumnFamilyStore.removeDeleted(cachedRow, gcBefore);