Updated Branches: refs/heads/cassandra-1.2 159744f24 -> 3cb5854e9
Fixing missing one row during reverse query on compact tables patch by slebresne; reviewed by iamaleksey for CASSANDRA-6330 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/3cb5854e Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/3cb5854e Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/3cb5854e Branch: refs/heads/cassandra-1.2 Commit: 3cb5854e9271ffc4e338841a49dd0b11d18e8c4f Parents: 159744f Author: Sylvain Lebresne <[email protected]> Authored: Tue Nov 12 19:09:46 2013 +0100 Committer: Sylvain Lebresne <[email protected]> Committed: Tue Nov 12 19:09:46 2013 +0100 ---------------------------------------------------------------------- CHANGES.txt | 1 + .../apache/cassandra/cql3/statements/SelectStatement.java | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/3cb5854e/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index e0a2320..7abf5d8 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -15,6 +15,7 @@ * Allow LOCAL_ONE/LOCAL_QUORUM to work with SimpleStrategy (CASSANDRA-6238) * cqlsh: handle 'null' as session duration (CASSANDRA-6317) * Fix json2sstable handling of range tombstones (CASSANDRA-6316) + * Fix missing one row in reverse query (CASSANDRA-6330) 1.2.11 http://git-wip-us.apache.org/repos/asf/cassandra/blob/3cb5854e/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java b/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java index 44a1e64..c1c88ba 100644 --- a/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java +++ b/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java @@ -376,9 +376,13 @@ public class SelectStatement implements CQLStatement private int getLimit() { - // Internally, we don't support exclusive bounds for slices. Instead, - // we query one more element if necessary and exclude - return sliceRestriction != null && !sliceRestriction.isInclusive(Bound.START) && parameters.limit != Integer.MAX_VALUE + // Internally, we don't support exclusive bounds for COMPACT slices. Instead, when we know we have an exlcusive + // slice on a COMPACT table, we query one more element (to make sure we don't return less results than asked post-exclusion) + // and exclude the post-query. Note that while we might excluse both the START and END bound, there is no reason to + // ask for limit + 2 since if we exlude both bound from the result it means we can't have missed non-fetched results. + return (sliceRestriction != null + && parameters.limit != Integer.MAX_VALUE + && (!sliceRestriction.isInclusive(Bound.START) || !sliceRestriction.isInclusive(Bound.END))) ? parameters.limit + 1 : parameters.limit; }
