cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From slebre...@apache.org
Subject git commit: Make sure DeletedColumn.isMFD always return true
Date Wed, 06 Jun 2012 08:06:13 GMT
Updated Branches:
  refs/heads/cassandra-1.1 0144f2fe4 -> ac8bbb17e


Make sure DeletedColumn.isMFD always return true

patch by Wade Simmons & slebresne; reviewed by jbellis for CASSANDRA-4307


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

Branch: refs/heads/cassandra-1.1
Commit: ac8bbb17ee86e2aede17672da5ee64824ae01381
Parents: 0144f2f
Author: Sylvain Lebresne <sylvain@datastax.com>
Authored: Wed Jun 6 10:04:32 2012 +0200
Committer: Sylvain Lebresne <sylvain@datastax.com>
Committed: Wed Jun 6 10:04:32 2012 +0200

----------------------------------------------------------------------
 CHANGES.txt                                        |    2 +
 .../org/apache/cassandra/db/DeletedColumn.java     |    8 ++++++
 .../org/apache/cassandra/db/RemoveColumnTest.java  |   20 +++++++++++++++
 3 files changed, 30 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/ac8bbb17/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index c0777d8..5a3bf5d 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,5 +1,7 @@
 1.1.2
  * enforce 1m min keycache for auto (CASSANDRA-4306)
+ * Have DeletedColumn.isMFD always return true (CASSANDRA-4307)
+
 
 1.1.1
  * add getsstables command to nodetool (CASSANDRA-4199)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/ac8bbb17/src/java/org/apache/cassandra/db/DeletedColumn.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/DeletedColumn.java b/src/java/org/apache/cassandra/db/DeletedColumn.java
index f67ffc8..a52d240 100644
--- a/src/java/org/apache/cassandra/db/DeletedColumn.java
+++ b/src/java/org/apache/cassandra/db/DeletedColumn.java
@@ -39,6 +39,14 @@ public class DeletedColumn extends Column
     }
 
     @Override
+    public boolean isMarkedForDelete()
+    {
+        // We don't rely on the column implementation because it could mistakenly return
false if
+        // some node are not exactly synchronized, which is problematic (see #4307)
+        return true;
+    }
+
+    @Override
     public long getMarkedForDeleteAt()
     {
         return timestamp;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/ac8bbb17/test/unit/org/apache/cassandra/db/RemoveColumnTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/RemoveColumnTest.java b/test/unit/org/apache/cassandra/db/RemoveColumnTest.java
index 67afba9..06ce57d 100644
--- a/test/unit/org/apache/cassandra/db/RemoveColumnTest.java
+++ b/test/unit/org/apache/cassandra/db/RemoveColumnTest.java
@@ -24,6 +24,7 @@ import java.util.concurrent.ExecutionException;
 import org.junit.Test;
 
 import static junit.framework.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
 
 import org.apache.cassandra.db.filter.QueryFilter;
 import org.apache.cassandra.db.filter.QueryPath;
@@ -59,4 +60,23 @@ public class RemoveColumnTest extends SchemaLoader
         assertNull(Util.cloneAndRemoveDeleted(retrieved, Integer.MAX_VALUE));
         assertNull(Util.cloneAndRemoveDeleted(store.getColumnFamily(QueryFilter.getIdentityFilter(dk,
new QueryPath("Standard1"))), Integer.MAX_VALUE));
     }
+
+    @Test
+    public void deletedColumnShouldAlwaysBeMarkedForDelete()
+    {
+        // Check for bug in #4307
+        long timestamp = System.currentTimeMillis();
+        int localDeletionTime = (int) (timestamp / 1000);
+        Column c = DeletedColumn.create(localDeletionTime, timestamp, "dc1");
+        assertTrue("DeletedColumn was not marked for delete", c.isMarkedForDelete());
+
+        // Simulate a node that is 30 seconds behind
+        c = DeletedColumn.create(localDeletionTime + 30, timestamp + 30000, "dc2");
+        assertTrue("DeletedColumn was not marked for delete", c.isMarkedForDelete());
+
+        // Simulate a node that is 30 ahead behind
+        c = DeletedColumn.create(localDeletionTime - 30, timestamp - 30000, "dc3");
+        assertTrue("DeletedColumn was not marked for delete", c.isMarkedForDelete());
+    }
+
 }


Mime
View raw message