Return-Path: X-Original-To: apmail-cassandra-commits-archive@www.apache.org Delivered-To: apmail-cassandra-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4D227100B8 for ; Tue, 12 Nov 2013 18:23:27 +0000 (UTC) Received: (qmail 55310 invoked by uid 500); 12 Nov 2013 18:23:25 -0000 Delivered-To: apmail-cassandra-commits-archive@cassandra.apache.org Received: (qmail 55191 invoked by uid 500); 12 Nov 2013 18:23:24 -0000 Mailing-List: contact commits-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list commits@cassandra.apache.org Received: (qmail 54543 invoked by uid 99); 12 Nov 2013 18:23:23 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 Nov 2013 18:23:23 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 192F98234E4; Tue, 12 Nov 2013 18:23:23 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: slebresne@apache.org To: commits@cassandra.apache.org Date: Tue, 12 Nov 2013 18:23:24 -0000 Message-Id: <01f6ebcb67c14ea3b9a7a52cb9c42742@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [2/5] git commit: Fixing missing one row during reverse query on compact tables 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/trunk Commit: 3cb5854e9271ffc4e338841a49dd0b11d18e8c4f Parents: 159744f Author: Sylvain Lebresne Authored: Tue Nov 12 19:09:46 2013 +0100 Committer: Sylvain Lebresne 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; }