cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From slebre...@apache.org
Subject cassandra git commit: Fix TTL unit test and dtests
Date Thu, 09 Jul 2015 07:04:44 GMT
Repository: cassandra
Updated Branches:
  refs/heads/trunk b053af2da -> 4cd5b8ef6


Fix TTL unit test and dtests

patch by slebresne; reviewed by stefania for CASSANDRA-9733


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

Branch: refs/heads/trunk
Commit: 4cd5b8ef65a47555ac79e62e5be6065c94350ce5
Parents: b053af2
Author: Stefania Alborghetti <stefania.alborghetti@datastax.com>
Authored: Wed Jul 8 17:11:56 2015 +0800
Committer: Sylvain Lebresne <sylvain@datastax.com>
Committed: Thu Jul 9 09:04:36 2015 +0200

----------------------------------------------------------------------
 .../cassandra/db/rows/TombstoneFilteringRow.java      |  6 ++++++
 .../org/apache/cassandra/service/DataResolver.java    | 14 +++++++++++---
 .../operations/InsertUpdateIfConditionTest.java       |  7 +++++++
 3 files changed, 24 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/4cd5b8ef/src/java/org/apache/cassandra/db/rows/TombstoneFilteringRow.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/rows/TombstoneFilteringRow.java b/src/java/org/apache/cassandra/db/rows/TombstoneFilteringRow.java
index a1c0ddc..a6167ea 100644
--- a/src/java/org/apache/cassandra/db/rows/TombstoneFilteringRow.java
+++ b/src/java/org/apache/cassandra/db/rows/TombstoneFilteringRow.java
@@ -30,6 +30,12 @@ public class TombstoneFilteringRow extends FilteringRow
     }
 
     @Override
+    protected boolean include (LivenessInfo info)
+    {
+        return info.isLive(nowInSec);
+    }
+
+    @Override
     protected boolean include(DeletionTime dt)
     {
         return false;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/4cd5b8ef/src/java/org/apache/cassandra/service/DataResolver.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/DataResolver.java b/src/java/org/apache/cassandra/service/DataResolver.java
index b2d1954..f164a60 100644
--- a/src/java/org/apache/cassandra/service/DataResolver.java
+++ b/src/java/org/apache/cassandra/service/DataResolver.java
@@ -123,9 +123,17 @@ public class DataResolver extends ResponseResolver
 
         private boolean isReversed(List<UnfilteredRowIterator> versions)
         {
-            assert !versions.isEmpty();
-            // Everything will be in the same order
-            return versions.get(0).isReverseOrder();
+            for (UnfilteredRowIterator iter : versions)
+            {
+                if (iter == null)
+                    continue;
+
+                // Everything will be in the same order
+                return iter.isReverseOrder();
+            }
+
+            assert false : "Expected at least one iterator";
+            return false;
         }
 
         public void close()

http://git-wip-us.apache.org/repos/asf/cassandra/blob/4cd5b8ef/test/unit/org/apache/cassandra/cql3/validation/operations/InsertUpdateIfConditionTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/validation/operations/InsertUpdateIfConditionTest.java
b/test/unit/org/apache/cassandra/cql3/validation/operations/InsertUpdateIfConditionTest.java
index 522495c..055c9d9 100644
--- a/test/unit/org/apache/cassandra/cql3/validation/operations/InsertUpdateIfConditionTest.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/operations/InsertUpdateIfConditionTest.java
@@ -166,6 +166,13 @@ public class InsertUpdateIfConditionTest extends CQLTester
         assertRows(execute("DELETE v1 FROM %s WHERE k=3 IF EXISTS"), row(true));
         assertRows(execute("DELETE FROM %s WHERE k=3 IF EXISTS"), row(true));
 
+        execute("INSERT INTO %s (k, v1) VALUES (4, 2)");
+        execute("UPDATE %s USING TTL 1 SET v1=2 WHERE k=4");
+        Thread.sleep(1001);
+        assertRows(execute("SELECT * FROM %s WHERE k=4"), row(4, null));
+        assertRows(execute("DELETE FROM %s WHERE k=4 IF EXISTS"), row(true));
+        assertEmpty(execute("SELECT * FROM %s WHERE k=4"));
+
         // static columns
         createTable("CREATE TABLE %s (k text, s text static, i int, v text, PRIMARY KEY (k,
i) )");
 


Mime
View raw message