cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From slebre...@apache.org
Subject [2/2] git commit: Finish cleanup up tombstone purge code
Date Tue, 14 Feb 2012 11:01:51 GMT
Finish cleanup up tombstone purge code

patch by slebresne; reviewed by jbellis for CASSANDRA-3872


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

Branch: refs/heads/trunk
Commit: 82a75d4ae7e7c21aa6e4106ed5457c4dfc2634cb
Parents: ee2a135
Author: Sylvain Lebresne <sylvain@datastax.com>
Authored: Tue Feb 14 12:00:11 2012 +0100
Committer: Sylvain Lebresne <sylvain@datastax.com>
Committed: Tue Feb 14 12:00:11 2012 +0100

----------------------------------------------------------------------
 CHANGES.txt                                        |    1 +
 .../db/AbstractThreadUnsafeSortedColumns.java      |    2 +-
 .../apache/cassandra/db/AtomicSortedColumns.java   |    4 ++--
 .../org/apache/cassandra/db/ColumnFamilyStore.java |    4 ++--
 .../org/apache/cassandra/db/ISortedColumns.java    |    8 ++++++--
 5 files changed, 12 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/82a75d4a/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index d39c9dd..e5693ca 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -73,6 +73,7 @@
  * make hexToBytes refuse invalid input (CASSANDRA-2851)
  * Make secondary indexes CF inherit compression and compaction from their
    parent CF (CASSANDRA-3877)
+ * Finish cleanup up tombstone purge code (CASSANDRA-3872)
 
 
 1.0.8

http://git-wip-us.apache.org/repos/asf/cassandra/blob/82a75d4a/src/java/org/apache/cassandra/db/AbstractThreadUnsafeSortedColumns.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/AbstractThreadUnsafeSortedColumns.java b/src/java/org/apache/cassandra/db/AbstractThreadUnsafeSortedColumns.java
index 8fc2764..b09b5ee 100644
--- a/src/java/org/apache/cassandra/db/AbstractThreadUnsafeSortedColumns.java
+++ b/src/java/org/apache/cassandra/db/AbstractThreadUnsafeSortedColumns.java
@@ -48,7 +48,7 @@ public abstract class AbstractThreadUnsafeSortedColumns implements ISortedColumn
     public void maybeResetDeletionTimes(int gcBefore)
     {
         // Update if it's not MIN_VALUE anymore and it has expired
-        if (deletionInfo.localDeletionTime != Integer.MIN_VALUE && deletionInfo.localDeletionTime
<= gcBefore)
+        if (deletionInfo.localDeletionTime <= gcBefore)
             deletionInfo = new DeletionInfo();
     }
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/82a75d4a/src/java/org/apache/cassandra/db/AtomicSortedColumns.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/AtomicSortedColumns.java b/src/java/org/apache/cassandra/db/AtomicSortedColumns.java
index 2542e46..5fdc0f6 100644
--- a/src/java/org/apache/cassandra/db/AtomicSortedColumns.java
+++ b/src/java/org/apache/cassandra/db/AtomicSortedColumns.java
@@ -121,8 +121,8 @@ public class AtomicSortedColumns implements ISortedColumns
         do
         {
             current = ref.get();
-            // Stop if we don't need to change the deletion info (it's still MIN_VALUE or
not expired yet)
-            if (current.deletionInfo.localDeletionTime == Integer.MIN_VALUE || current.deletionInfo.localDeletionTime
> gcBefore)
+            // Stop if we don't need to change the deletion info (not expired yet)
+            if (current.deletionInfo.localDeletionTime > gcBefore)
                 break;
         }
         while (!ref.compareAndSet(current, current.with(new DeletionInfo())));

http://git-wip-us.apache.org/repos/asf/cassandra/blob/82a75d4a/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/ColumnFamilyStore.java b/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
index bf4a000..e4e3204 100644
--- a/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
+++ b/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
@@ -745,7 +745,7 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
 
     public static ColumnFamily removeDeletedCF(ColumnFamily cf, int gcBefore)
     {
-        if (cf.getColumnCount() == 0 && cf.getLocalDeletionTime() < gcBefore)
+        if (cf.getColumnCount() == 0 && (!cf.isMarkedForDelete() || cf.getLocalDeletionTime()
< gcBefore))
             return null;
 
         cf.maybeResetDeletionTimes(gcBefore);
@@ -818,7 +818,7 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
                     subIter.remove();
                 }
             }
-            if (c.getSubColumns().isEmpty() && c.getLocalDeletionTime() < gcBefore)
+            if (c.getSubColumns().isEmpty() && (!c.isMarkedForDelete() || c.getLocalDeletionTime()
< gcBefore))
             {
                 iter.remove();
             }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/82a75d4a/src/java/org/apache/cassandra/db/ISortedColumns.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/ISortedColumns.java b/src/java/org/apache/cassandra/db/ISortedColumns.java
index 6320112..1200544 100644
--- a/src/java/org/apache/cassandra/db/ISortedColumns.java
+++ b/src/java/org/apache/cassandra/db/ISortedColumns.java
@@ -176,14 +176,18 @@ public interface ISortedColumns extends IIterableColumns
 
         public DeletionInfo()
         {
-            this(Long.MIN_VALUE, Integer.MIN_VALUE);
+            this(Long.MIN_VALUE, Integer.MAX_VALUE);
         }
 
         public DeletionInfo(long markedForDeleteAt, int localDeletionTime)
         {
+            // Pre-1.1 node may return MIN_VALUE for non-deleted container, but the new default
is MAX_VALUE
+            // (see CASSANDRA-3872)
+            if (localDeletionTime == Integer.MIN_VALUE)
+                localDeletionTime = Integer.MAX_VALUE;
+
             this.markedForDeleteAt = markedForDeleteAt;
             this.localDeletionTime = localDeletionTime;
         }
     }
-
 }


Mime
View raw message