Repository: cassandra Updated Branches: refs/heads/trunk 5dd2247dd -> 21b04cf31
Fix RangeNamesQueryPager (CASSANDRA-10509) patch by Stefania Alborghetti; reviewed by Benjamin Lerer for CASSANDRA-10509 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/289b7b7c Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/289b7b7c Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/289b7b7c Branch: refs/heads/trunk Commit: 289b7b7cefd7ee5e1c41f7527a41fa40141ee7f7 Parents: 20ce2cf Author: Stefania Alborghetti <stefania.alborghe...@datastax.com> Authored: Mon Oct 19 14:04:36 2015 +0200 Committer: blerer <benjamin.le...@datastax.com> Committed: Mon Oct 19 14:07:44 2015 +0200 ---------------------------------------------------------------------- CHANGES.txt | 1 + .../apache/cassandra/service/pager/RangeNamesQueryPager.java | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/289b7b7c/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index 889438f..0904559 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,5 @@ 2.2.4 + * Fix RangeNamesQueryPager (CASSANDRA-10509) * Deprecate Pig support (CASSANDRA-10542) * Reduce contention getting instances of CompositeType (CASSANDRA-10433) Merged from 2.1: http://git-wip-us.apache.org/repos/asf/cassandra/blob/289b7b7c/src/java/org/apache/cassandra/service/pager/RangeNamesQueryPager.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/service/pager/RangeNamesQueryPager.java b/src/java/org/apache/cassandra/service/pager/RangeNamesQueryPager.java index 50d1280..6b36a25 100644 --- a/src/java/org/apache/cassandra/service/pager/RangeNamesQueryPager.java +++ b/src/java/org/apache/cassandra/service/pager/RangeNamesQueryPager.java @@ -81,7 +81,9 @@ public class RangeNamesQueryPager extends AbstractQueryPager protected boolean containsPreviousLast(Row first) { // When querying the next page, we create a bound that exclude the lastReturnedKey - return false; + // but unfortunately ExcludingBounds is serialized as Bounds, which includes both endpoints, + // so we may still get a live row with the same key as lastReturnedKey, see CASSANDRA-10509 + return lastReturnedKey != null && lastReturnedKey.equals(first.key); } protected boolean recordLast(Row last) @@ -103,11 +105,11 @@ public class RangeNamesQueryPager extends AbstractQueryPager AbstractBounds<RowPosition> bounds = command.keyRange; if (bounds instanceof Range || bounds instanceof Bounds) { - return new Range<RowPosition>(lastReturnedKey, bounds.right); + return new Range<>(lastReturnedKey, bounds.right); } else { - return new ExcludingBounds<RowPosition>(lastReturnedKey, bounds.right); + return new ExcludingBounds<>(lastReturnedKey, bounds.right); } } }