Repository: cassandra
Updated Branches:
  refs/heads/cassandra-3.0 2e36eb6ca -> 462b9cf63
  refs/heads/cassandra-3.11 420c91c9a -> 6b87e49c3
  refs/heads/trunk f87ec773f -> 0f054fee5


Fix the conversion of 2.X expired rows without regular column data

patch by Benjamin Lerer; reviewed by Sylvain Lebresne for CASSANDRA-13395


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

Branch: refs/heads/cassandra-3.0
Commit: 462b9cf63bf986671f8a080ef1802f0c27e7c772
Parents: 2e36eb6
Author: Benjamin Lerer <b.le...@gmail.com>
Authored: Tue Apr 4 11:57:41 2017 +0200
Committer: Benjamin Lerer <b.le...@gmail.com>
Committed: Tue Apr 4 11:57:41 2017 +0200

----------------------------------------------------------------------
 CHANGES.txt                                        |  1 +
 src/java/org/apache/cassandra/db/LegacyLayout.java | 12 ++++++++++--
 2 files changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/462b9cf6/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 41489c1..4126b07 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 3.0.13
+ * Fix the conversion of 2.X expired rows without regular column data 
(CASSANDRA-13395)
  * Fix hint delivery when using ext+internal IPs with prefer_local enabled 
(CASSANDRA-13020)
  * Fix possible NPE on upgrade to 3.0/3.X in case of IO errors 
(CASSANDRA-13389)
  * Legacy deserializer can create empty range tombstones (CASSANDRA-13341)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/462b9cf6/src/java/org/apache/cassandra/db/LegacyLayout.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/LegacyLayout.java 
b/src/java/org/apache/cassandra/db/LegacyLayout.java
index bfe3bff..669fb1c 100644
--- a/src/java/org/apache/cassandra/db/LegacyLayout.java
+++ b/src/java/org/apache/cassandra/db/LegacyLayout.java
@@ -1128,6 +1128,11 @@ public abstract class LegacyLayout
 
     public static class CellGrouper
     {
+        /**
+         * The fake TTL used for expired rows that have been compacted.
+         */
+        private static final int FAKE_TTL = 1;
+
         public final CFMetaData metadata;
         private final boolean isStatic;
         private final SerializationHelper helper;
@@ -1194,14 +1199,17 @@ public abstract class LegacyLayout
             {
                 // It's the row marker
                 assert !cell.value.hasRemaining();
-                // In 2.1, the row marker expired cell might have been 
converted into a deleted one by compaction. So,
-                // we need to set the primary key liveness info only if the 
cell is not a deleted one.
+                // In 2.1, the row marker expired cell might have been 
converted into a deleted one by compaction.
+                // If we do not set the primary key liveness info for this row 
and it does not contains any regular columns
+                // the row will be empty. To avoid that, we reuse the 
localDeletionTime but use a fake TTL.
                 // The only time in 2.x that we actually delete a row marker 
is in 2i tables, so in that case we do
                 // want to actually propagate the row deletion. 
(CASSANDRA-13320)
                 if (!cell.isTombstone())
                     
builder.addPrimaryKeyLivenessInfo(LivenessInfo.create(cell.timestamp, cell.ttl, 
cell.localDeletionTime));
                 else if (metadata.isIndex())
                     builder.addRowDeletion(Row.Deletion.regular(new 
DeletionTime(cell.timestamp, cell.localDeletionTime)));
+                else
+                    
builder.addPrimaryKeyLivenessInfo(LivenessInfo.create(cell.timestamp, FAKE_TTL, 
cell.localDeletionTime));
             }
             else
             {

Reply via email to