clarify that we only collect row-level tombstone in LCR constructor

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

Branch: refs/heads/trunk
Commit: 4e9a7b8c7fa55df9cda4ac06f77ee9c69b85314d
Parents: 3edb62b
Author: Jonathan Ellis <[email protected]>
Authored: Thu Dec 12 23:43:59 2013 +0600
Committer: Jonathan Ellis <[email protected]>
Committed: Fri Dec 13 00:26:14 2013 +0600

----------------------------------------------------------------------
 .../db/compaction/LazilyCompactedRow.java       | 26 ++++++++++----------
 1 file changed, 13 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/4e9a7b8c/src/java/org/apache/cassandra/db/compaction/LazilyCompactedRow.java
----------------------------------------------------------------------
diff --git 
a/src/java/org/apache/cassandra/db/compaction/LazilyCompactedRow.java 
b/src/java/org/apache/cassandra/db/compaction/LazilyCompactedRow.java
index 3b7a3d4..0d33b22 100644
--- a/src/java/org/apache/cassandra/db/compaction/LazilyCompactedRow.java
+++ b/src/java/org/apache/cassandra/db/compaction/LazilyCompactedRow.java
@@ -58,8 +58,7 @@ public class LazilyCompactedRow extends AbstractCompactedRow 
implements Iterable
     private boolean closed;
     private ColumnIndex.Builder indexBuilder;
     private final SecondaryIndexManager.Updater indexer;
-    private long maxTombstoneTimestamp;
-    private DeletionInfo deletionInfo;
+    private DeletionTime maxRowTombstone;
 
     public LazilyCompactedRow(CompactionController controller, List<? extends 
OnDiskAtomIterator> rows)
     {
@@ -70,23 +69,23 @@ public class LazilyCompactedRow extends 
AbstractCompactedRow implements Iterable
 
         // Combine top-level tombstones, keeping the one with the highest 
markedForDeleteAt timestamp.  This may be
         // purged (depending on gcBefore), but we need to remember it to 
properly delete columns during the merge
-        deletionInfo = DeletionInfo.live();
-        maxTombstoneTimestamp = Long.MIN_VALUE;
+        maxRowTombstone = DeletionTime.LIVE;
         for (OnDiskAtomIterator row : rows)
         {
-            DeletionInfo delInfo = row.getColumnFamily().deletionInfo();
-            maxTombstoneTimestamp = Math.max(maxTombstoneTimestamp, 
delInfo.maxTimestamp());
-            deletionInfo = deletionInfo.add(delInfo);
+            DeletionTime rowTombstone = 
row.getColumnFamily().deletionInfo().getTopLevelDeletion();
+            if (maxRowTombstone.compareTo(rowTombstone) < 0)
+                maxRowTombstone = rowTombstone;
         }
 
+
         // Don't pass maxTombstoneTimestamp to shouldPurge since we might well 
have cells with
         // tombstones newer than the row-level tombstones we've seen -- but we 
won't know that
         // until we iterate over them.  By passing MAX_VALUE we will only 
purge if there are
         // no other versions of this row present.
         this.shouldPurge = controller.shouldPurge(key, Long.MAX_VALUE);
 
-        emptyColumnFamily = 
ArrayBackedSortedColumns.factory.create(controller.cfs.metadata);
-        emptyColumnFamily.setDeletionInfo(deletionInfo.copy());
+        emptyColumnFamily = 
EmptyColumns.factory.create(controller.cfs.metadata);
+        emptyColumnFamily.delete(maxRowTombstone);
         if (shouldPurge)
             emptyColumnFamily.purgeTombstones(controller.gcBefore);
     }
@@ -113,7 +112,7 @@ public class LazilyCompactedRow extends 
AbstractCompactedRow implements Iterable
         // (however, if there are zero columns, iterator() will not be called 
by ColumnIndexer and reducer will be null)
         columnStats = new ColumnStats(reducer == null ? 0 : reducer.columns,
                                       reducer == null ? Long.MAX_VALUE : 
reducer.minTimestampSeen,
-                                      reducer == null ? maxTombstoneTimestamp 
: Math.max(maxTombstoneTimestamp, reducer.maxTimestampSeen),
+                                      reducer == null ? 
maxRowTombstone.markedForDeleteAt : Math.max(maxRowTombstone.markedForDeleteAt, 
reducer.maxTimestampSeen),
                                       reducer == null ? Integer.MIN_VALUE : 
reducer.maxLocalDeletionTimeSeen,
                                       reducer == null ? new 
StreamingHistogram(SSTable.TOMBSTONE_HISTOGRAM_BIN_SIZE) : reducer.tombstones,
                                       reducer == null ? 
Collections.<ByteBuffer>emptyList() : reducer.minColumnNameSeen,
@@ -193,8 +192,9 @@ public class LazilyCompactedRow extends 
AbstractCompactedRow implements Iterable
     private class Reducer extends MergeIterator.Reducer<OnDiskAtom, OnDiskAtom>
     {
         // all columns reduced together will have the same name, so there will 
only be one column
-        // in the container; we just want to leverage the conflict resolution 
code from CF
-        ColumnFamily container = 
emptyColumnFamily.cloneMeShallow(ArrayBackedSortedColumns.factory, false);
+        // in the container; we just want to leverage the conflict resolution 
code from CF.
+        // (Note that we add the row tombstone in getReduced.)
+        final ColumnFamily container = 
ArrayBackedSortedColumns.factory.create(emptyColumnFamily.metadata());
 
         // tombstone reference; will be reconciled w/ column during 
getReduced.  Note that the top-level (row) tombstone
         // is held by LCR.deletionInfo.
@@ -258,7 +258,7 @@ public class LazilyCompactedRow extends 
AbstractCompactedRow implements Iterable
             else
             {
                 // when we clear() the container, it removes the deletion 
info, so this needs to be reset each time
-                container.setDeletionInfo(deletionInfo);
+                container.delete(maxRowTombstone);
                 ColumnFamily purged = 
PrecompactedRow.removeDeletedAndOldShards(key, shouldPurge, controller, 
container);
                 if (purged == null || !purged.iterator().hasNext())
                 {

Reply via email to