Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id BAE8D200B8C for ; Mon, 12 Sep 2016 10:38:40 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id B97F4160AC8; Mon, 12 Sep 2016 08:38:40 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id D957B160AB8 for ; Mon, 12 Sep 2016 10:38:39 +0200 (CEST) Received: (qmail 45511 invoked by uid 500); 12 Sep 2016 08:38:39 -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 45500 invoked by uid 99); 12 Sep 2016 08:38:39 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Sep 2016 08:38:39 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id E7981DFE80; Mon, 12 Sep 2016 08:38:38 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: blerer@apache.org To: commits@cassandra.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: cassandra git commit: Fix paging for 2.x to 3.x upgrades Date: Mon, 12 Sep 2016 08:38:38 +0000 (UTC) archived-at: Mon, 12 Sep 2016 08:38:40 -0000 Repository: cassandra Updated Branches: refs/heads/cassandra-3.9 6facdf0be -> c11c7d73d Fix paging for 2.x to 3.x upgrades patch by Benjamin Lerer; reviewed by Sylvain Lebresne for CASSANDRA-11195 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/c11c7d73 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/c11c7d73 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/c11c7d73 Branch: refs/heads/cassandra-3.9 Commit: c11c7d73d086f89521805ce7cc1907d5788ab969 Parents: 6facdf0 Author: Benjamin Lerer Authored: Mon Sep 12 10:37:27 2016 +0200 Committer: Benjamin Lerer Committed: Mon Sep 12 10:37:27 2016 +0200 ---------------------------------------------------------------------- CHANGES.txt | 1 + .../apache/cassandra/cql3/statements/SelectStatement.java | 5 +---- src/java/org/apache/cassandra/db/ReadCommand.java | 8 +++----- src/java/org/apache/cassandra/db/ReadResponse.java | 10 +++------- 4 files changed, 8 insertions(+), 16 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/c11c7d73/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index 5a73dd8..e849d28 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -34,6 +34,7 @@ * Add repaired percentage metric (CASSANDRA-11503) * Add Change-Data-Capture (CASSANDRA-8844) Merged from 3.0: + * Fix paging for 2.x to 3.x upgrades (CASSANDRA-11195) * Fix clean interval not sent to commit log for empty memtable flush (CASSANDRA-12436) * Fix potential resource leak in RMIServerSocketFactoryImpl (CASSANDRA-12331) * Make sure compaction stats are updated when compaction is interrupted (CASSANDRA-12100) http://git-wip-us.apache.org/repos/asf/cassandra/blob/c11c7d73/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 f2b484e..a8b97d1 100644 --- a/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java +++ b/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java @@ -21,9 +21,7 @@ import java.nio.ByteBuffer; import java.util.*; import com.google.common.base.MoreObjects; -import com.google.common.base.Objects; -import com.google.common.base.Predicate; -import com.google.common.collect.Iterables; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -64,7 +62,6 @@ import static org.apache.cassandra.cql3.statements.RequestValidations.checkFalse import static org.apache.cassandra.cql3.statements.RequestValidations.checkNotNull; import static org.apache.cassandra.cql3.statements.RequestValidations.checkNull; import static org.apache.cassandra.cql3.statements.RequestValidations.checkTrue; -import static org.apache.cassandra.cql3.statements.RequestValidations.invalidRequest; import static org.apache.cassandra.utils.ByteBufferUtil.UNSET_BYTE_BUFFER; /** http://git-wip-us.apache.org/repos/asf/cassandra/blob/c11c7d73/src/java/org/apache/cassandra/db/ReadCommand.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/db/ReadCommand.java b/src/java/org/apache/cassandra/db/ReadCommand.java index 68c9e3b..9542703 100644 --- a/src/java/org/apache/cassandra/db/ReadCommand.java +++ b/src/java/org/apache/cassandra/db/ReadCommand.java @@ -1075,7 +1075,7 @@ public abstract class ReadCommand extends MonitorableImpl implements ReadQuery // slice filter's stop. DataRange.Paging pagingRange = (DataRange.Paging) rangeCommand.dataRange(); Clustering lastReturned = pagingRange.getLastReturned(); - ClusteringBound newStart = ClusteringBound.exclusiveStartOf(lastReturned); + ClusteringBound newStart = ClusteringBound.inclusiveStartOf(lastReturned); Slice lastSlice = filter.requestedSlices().get(filter.requestedSlices().size() - 1); ByteBufferUtil.writeWithShortLength(LegacyLayout.encodeBound(metadata, newStart, true), out); ByteBufferUtil.writeWithShortLength(LegacyLayout.encodeClustering(metadata, lastSlice.end().clustering()), out); @@ -1084,10 +1084,8 @@ public abstract class ReadCommand extends MonitorableImpl implements ReadQuery // command-level limit // Pre-3.0 we would always request one more row than we actually needed and the command-level "start" would - // be the last-returned cell name, so the response would always include it. When dealing with compound comparators, - // we can pass an exclusive start and use the normal limit. However, when dealing with non-compound comparators, - // pre-3.0 nodes cannot perform exclusive slices, so we need to request one extra row. - int maxResults = rangeCommand.limits().count() + (metadata.isCompound() ? 0 : 1); + // be the last-returned cell name, so the response would always include it. + int maxResults = rangeCommand.limits().count() + 1; out.writeInt(maxResults); // countCQL3Rows http://git-wip-us.apache.org/repos/asf/cassandra/blob/c11c7d73/src/java/org/apache/cassandra/db/ReadResponse.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/db/ReadResponse.java b/src/java/org/apache/cassandra/db/ReadResponse.java index 05ebd00..cca21f8 100644 --- a/src/java/org/apache/cassandra/db/ReadResponse.java +++ b/src/java/org/apache/cassandra/db/ReadResponse.java @@ -280,13 +280,9 @@ public abstract class ReadResponse ClusteringIndexFilter filter = command.clusteringIndexFilter(partition.partitionKey()); - // Pre-3.0, we didn't have a way to express exclusivity for non-composite comparators, so all slices were - // inclusive on both ends. If we have exclusive slice ends, we need to filter the results here. - UnfilteredRowIterator iterator; - if (!command.metadata().isCompound()) - iterator = partition.unfilteredIterator(command.columnFilter(), filter.getSlices(command.metadata()), filter.isReversed()); - else - iterator = partition.unfilteredIterator(command.columnFilter(), Slices.ALL, filter.isReversed()); + // Pre-3.0, we would always request one more row than we actually needed and the command-level "start" would + // be the last-returned cell name, so the response would always include it. + UnfilteredRowIterator iterator = partition.unfilteredIterator(command.columnFilter(), filter.getSlices(command.metadata()), filter.isReversed()); // Wrap results with a ThriftResultMerger only if they're intended for the thrift command. if (command.isForThrift())