Repository: cassandra Updated Branches: refs/heads/cassandra-2.0 6c0ee30ea -> 19c2f54b3
Fix dupes in DISTINCT queries on static cols w/ paging Patch by Tyler Hobbs; reviewed by Sylvain Lebresne for CASSANDRA-8108 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/19c2f54b Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/19c2f54b Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/19c2f54b Branch: refs/heads/cassandra-2.0 Commit: 19c2f54b3ac918961109d3c13edf7ea18086076c Parents: 6c0ee30 Author: Tyler Hobbs <ty...@datastax.com> Authored: Thu Oct 16 11:04:05 2014 -0500 Committer: Tyler Hobbs <ty...@datastax.com> Committed: Thu Oct 16 11:04:05 2014 -0500 ---------------------------------------------------------------------- CHANGES.txt | 2 ++ .../org/apache/cassandra/service/pager/SliceQueryPager.java | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/19c2f54b/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index 432750a..967b90c 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,6 @@ 2.0.11: + * Fix duplicate results in DISTINCT queries on static columns with query + paging (CASSANDRA-8108) * Properly validate ascii and utf8 string literals in CQL queries (CASSANDRA-8101) * (cqlsh) Fix autocompletion for alter keyspace (CASSANDRA-8021) * Create backup directories for commitlog archiving during startup (CASSANDRA-8111) http://git-wip-us.apache.org/repos/asf/cassandra/blob/19c2f54b/src/java/org/apache/cassandra/service/pager/SliceQueryPager.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/service/pager/SliceQueryPager.java b/src/java/org/apache/cassandra/service/pager/SliceQueryPager.java index ec229cb..cdad0a5 100644 --- a/src/java/org/apache/cassandra/service/pager/SliceQueryPager.java +++ b/src/java/org/apache/cassandra/service/pager/SliceQueryPager.java @@ -73,7 +73,10 @@ public class SliceQueryPager extends AbstractQueryPager implements SinglePartiti protected List<Row> queryNextPage(int pageSize, ConsistencyLevel consistencyLevel, boolean localQuery) throws RequestValidationException, RequestExecutionException { - SliceQueryFilter filter = command.filter.withUpdatedCount(pageSize); + // For some queries, such as a DISTINCT query on static columns, the limit for slice queries will be lower + // than the page size (in the static example, it will be 1). We use the min here to ensure we don't fetch + // more rows than we're supposed to. See CASSANDRA-8108 for more details. + SliceQueryFilter filter = command.filter.withUpdatedCount(Math.min(command.filter.count, pageSize)); if (lastReturned != null) filter = filter.withUpdatedStart(lastReturned, cfm.comparator);