cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From slebre...@apache.org
Subject [2/2] cassandra git commit: Assert !reversed in updateBlock and improve test
Date Wed, 23 Dec 2015 11:23:09 GMT
Assert !reversed in updateBlock and improve test


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

Branch: refs/heads/10903
Commit: e7c6e14fd2662c35310d1b27017aed75640ce002
Parents: bc887ac
Author: Sylvain Lebresne <sylvain@datastax.com>
Authored: Wed Dec 23 12:13:54 2015 +0100
Committer: Sylvain Lebresne <sylvain@datastax.com>
Committed: Wed Dec 23 12:18:38 2015 +0100

----------------------------------------------------------------------
 .../cassandra/db/columniterator/AbstractSSTableIterator.java     | 4 ++++
 .../org/apache/cassandra/cql3/QueryWithIndexedSSTableTest.java   | 4 ++++
 2 files changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/e7c6e14f/src/java/org/apache/cassandra/db/columniterator/AbstractSSTableIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/columniterator/AbstractSSTableIterator.java
b/src/java/org/apache/cassandra/db/columniterator/AbstractSSTableIterator.java
index f103ee2..8ac3dcb 100644
--- a/src/java/org/apache/cassandra/db/columniterator/AbstractSSTableIterator.java
+++ b/src/java/org/apache/cassandra/db/columniterator/AbstractSSTableIterator.java
@@ -443,8 +443,12 @@ abstract class AbstractSSTableIterator implements SliceableUnfilteredRowIterator
         }
 
         // Update the block idx based on the current reader position if we're past the current
block.
+        // This only makes sense for forward iteration (for reverse ones, when we reach the
end of a block we
+        // should seek to the previous one, not update the index state and continue).
         public void updateBlock() throws IOException
         {
+            assert !reversed;
+
             // If we get here with currentBlockIdx < 0, it means setToBlock() has never
been called, so it means
             // we're about to read from the beginning of the partition, but haven't "prepared"
the IndexState yet.
             // Do so by setting us on the first block.

http://git-wip-us.apache.org/repos/asf/cassandra/blob/e7c6e14f/test/unit/org/apache/cassandra/cql3/QueryWithIndexedSSTableTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/QueryWithIndexedSSTableTest.java b/test/unit/org/apache/cassandra/cql3/QueryWithIndexedSSTableTest.java
index 00f0ca2..4838392 100644
--- a/test/unit/org/apache/cassandra/cql3/QueryWithIndexedSSTableTest.java
+++ b/test/unit/org/apache/cassandra/cql3/QueryWithIndexedSSTableTest.java
@@ -65,6 +65,10 @@ public class QueryWithIndexedSSTableTest extends CQLTester
         assert hasIndexed;
 
         assertRowCount(execute("SELECT s FROM %s WHERE k = ?", 0), ROWS);
+        assertRowCount(execute("SELECT s FROM %s WHERE k = ? ORDER BY t DESC", 0), ROWS);
+
+        assertRowCount(execute("SELECT DISTINCT s FROM %s WHERE k = ?", 0), 1);
+        assertRowCount(execute("SELECT DISTINCT s FROM %s WHERE k = ? ORDER BY t DESC", 0),
1);
     }
 
     // Creates a random string 


Mime
View raw message