You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by be...@apache.org on 2015/05/07 12:26:05 UTC

[2/3] cassandra git commit: Improve sstable exclusion from partition tombstones

Improve sstable exclusion from partition tombstones

patch by benedict; reviewed by aleksey for CASSANDRA-9298


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

Branch: refs/heads/trunk
Commit: b14236f946337cab5f78407253bd296a6f3fbb22
Parents: ce3ce44
Author: Benedict Elliott Smith <be...@apache.org>
Authored: Thu May 7 11:24:50 2015 +0100
Committer: Benedict Elliott Smith <be...@apache.org>
Committed: Thu May 7 11:24:50 2015 +0100

----------------------------------------------------------------------
 CHANGES.txt                                             |  1 +
 .../org/apache/cassandra/db/CollationController.java    | 12 +++---------
 2 files changed, 4 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/b14236f9/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 09bdfb1..6363974 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.1.6
+ * Improve sstable exclusion from partition tombstones (CASSANDRA-9298)
  * Validate the indexed column rather than the cell's contents for 2i (CASSANDRA-9057)
  * Add support for top-k custom 2i queries (CASSANDRA-8717)
  * Fix error when dropping table during compaction (CASSANDRA-9251)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/b14236f9/src/java/org/apache/cassandra/db/CollationController.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/CollationController.java b/src/java/org/apache/cassandra/db/CollationController.java
index 4efcd9c..5c6a3db 100644
--- a/src/java/org/apache/cassandra/db/CollationController.java
+++ b/src/java/org/apache/cassandra/db/CollationController.java
@@ -77,11 +77,11 @@ public class CollationController
         boolean isEmpty = true;
         Tracing.trace("Acquiring sstable references");
         ColumnFamilyStore.ViewFragment view = cfs.select(cfs.viewFilter(filter.key));
+        DeletionInfo returnDeletionInfo = container.deletionInfo();
 
         try
         {
             Tracing.trace("Merging memtable contents");
-            long mostRecentRowTombstone = Long.MIN_VALUE;
             for (Memtable memtable : view.memtables)
             {
                 ColumnFamily cf = memtable.getColumnFamily(filter.key);
@@ -98,7 +98,6 @@ public class CollationController
                         container.addColumn(cell);
                     }
                 }
-                mostRecentRowTombstone = container.deletionInfo().getTopLevelDeletion().markedForDeleteAt;
             }
 
             // avoid changing the filter columns of the original filter
@@ -116,7 +115,7 @@ public class CollationController
                 // if we've already seen a row tombstone with a timestamp greater
                 // than the most recent update to this sstable, we're done, since the rest of the sstables
                 // will also be older
-                if (sstable.getMaxTimestamp() < mostRecentRowTombstone)
+                if (sstable.getMaxTimestamp() < returnDeletionInfo.getTopLevelDeletion().markedForDeleteAt)
                     break;
 
                 long currentMaxTs = sstable.getMaxTimestamp();
@@ -136,7 +135,6 @@ public class CollationController
                     while (iter.hasNext())
                         container.addAtom(iter.next());
                 }
-                mostRecentRowTombstone = container.deletionInfo().getTopLevelDeletion().markedForDeleteAt;
             }
 
             // we need to distinguish between "there is no data at all for this row" (BF will let us rebuild that efficiently)
@@ -244,7 +242,6 @@ public class CollationController
              */
             Collections.sort(view.sstables, SSTableReader.maxTimestampComparator);
             List<SSTableReader> skippedSSTables = null;
-            long mostRecentRowTombstone = Long.MIN_VALUE;
             long minTimestamp = Long.MAX_VALUE;
             int nonIntersectingSSTables = 0;
 
@@ -253,7 +250,7 @@ public class CollationController
                 minTimestamp = Math.min(minTimestamp, sstable.getMinTimestamp());
                 // if we've already seen a row tombstone with a timestamp greater
                 // than the most recent update to this sstable, we can skip it
-                if (sstable.getMaxTimestamp() < mostRecentRowTombstone)
+                if (sstable.getMaxTimestamp() < returnDeletionInfo.getTopLevelDeletion().markedForDeleteAt)
                     break;
 
                 if (!filter.shouldInclude(sstable))
@@ -275,9 +272,6 @@ public class CollationController
                 if (iter.getColumnFamily() != null)
                 {
                     ColumnFamily cf = iter.getColumnFamily();
-                    if (cf.isMarkedForDelete())
-                        mostRecentRowTombstone = cf.deletionInfo().getTopLevelDeletion().markedForDeleteAt;
-
                     returnCF.delete(cf);
                     sstablesIterated++;
                 }