cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ble...@apache.org
Subject [1/5] cassandra git commit: Fix paging for DISTINCT queries on partition keys and static columns
Date Wed, 11 Jan 2017 20:28:57 GMT
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-3.11 1553d864b -> 9c2ab2555


Fix paging for DISTINCT queries on partition keys and static columns

patch by Benjamin Lerer; reviewed by Tyler Hobbs for CASSANDRA-13017


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

Branch: refs/heads/cassandra-3.11
Commit: 70e8b39b021b0abae69009c4a034657e2518e09e
Parents: 47f7d9c
Author: Benjamin Lerer <b.lerer@gmail.com>
Authored: Wed Jan 11 21:05:37 2017 +0100
Committer: Benjamin Lerer <b.lerer@gmail.com>
Committed: Wed Jan 11 21:05:37 2017 +0100

----------------------------------------------------------------------
 CHANGES.txt                                                       | 1 +
 .../org/apache/cassandra/service/pager/RangeSliceQueryPager.java  | 3 ++-
 test/unit/org/apache/cassandra/service/QueryPagerTest.java        | 2 +-
 3 files changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/70e8b39b/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 23fd12a..414d6ed 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.1.17
+ * Fix paging for DISTINCT queries on partition keys and static columns (CASSANDRA-13017)
  * Fix race causing infinite loop if Thrift server is stopped before it starts listening
(CASSANDRA-12856)
  * cqlsh copy-from: sort user type fields in csv (CASSANDRA-12959)
  * Fix missed signal when commit log segments are recycled (CASSANDRA-13037)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/70e8b39b/src/java/org/apache/cassandra/service/pager/RangeSliceQueryPager.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/pager/RangeSliceQueryPager.java b/src/java/org/apache/cassandra/service/pager/RangeSliceQueryPager.java
index caa146a..3ac777e 100644
--- a/src/java/org/apache/cassandra/service/pager/RangeSliceQueryPager.java
+++ b/src/java/org/apache/cassandra/service/pager/RangeSliceQueryPager.java
@@ -74,7 +74,8 @@ public class RangeSliceQueryPager extends AbstractQueryPager
     {
         SliceQueryFilter sf = (SliceQueryFilter)columnFilter;
         AbstractBounds<RowPosition> keyRange = lastReturnedKey == null ? command.keyRange
: makeIncludingKeyBounds(lastReturnedKey);
-        Composite start = lastReturnedName == null ? sf.start() : lastReturnedName;
+        // For DISTINCT queries we can and must ignore the lastReturnedName (see CASSANDRA-13017)
+        Composite start = lastReturnedName == null || isDistinct() ? sf.start() : lastReturnedName;
         PagedRangeCommand pageCmd = new PagedRangeCommand(command.keyspace,
                                                           command.columnFamily,
                                                           command.timestamp,

http://git-wip-us.apache.org/repos/asf/cassandra/blob/70e8b39b/test/unit/org/apache/cassandra/service/QueryPagerTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/service/QueryPagerTest.java b/test/unit/org/apache/cassandra/service/QueryPagerTest.java
index c78412f..1939c4a 100644
--- a/test/unit/org/apache/cassandra/service/QueryPagerTest.java
+++ b/test/unit/org/apache/cassandra/service/QueryPagerTest.java
@@ -146,7 +146,7 @@ public class QueryPagerTest extends SchemaLoader
     private static RangeSliceCommand rangeSliceQuery(AbstractBounds<RowPosition> range,
int count, String start, String end)
     {
         SliceQueryFilter filter = new SliceQueryFilter(CellNames.simpleDense(bytes(start)),
CellNames.simpleDense(bytes(end)), false, Integer.MAX_VALUE);
-        return new RangeSliceCommand(KS, CF, System.currentTimeMillis(), filter, range, count);
+        return new RangeSliceCommand(KS, CF, System.currentTimeMillis(), filter, range, null,
count, true, false);
     }
 
     private static void assertRow(Row r, String key, String... names)


Mime
View raw message