You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by bl...@apache.org on 2016/09/12 08:51:14 UTC
[1/4] cassandra git commit: Fix paging for 2.x to 3.x upgrades
Repository: cassandra
Updated Branches:
refs/heads/trunk f0b229afb -> 4354db24c
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/932f3ebb
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/932f3ebb
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/932f3ebb
Branch: refs/heads/trunk
Commit: 932f3ebbe9005582a4e253c84f4f20aef3a0abac
Parents: 893fd21
Author: Benjamin Lerer <b....@gmail.com>
Authored: Mon Sep 12 10:27:58 2016 +0200
Committer: Benjamin Lerer <b....@gmail.com>
Committed: Mon Sep 12 10:27:58 2016 +0200
----------------------------------------------------------------------
CHANGES.txt | 1 +
src/java/org/apache/cassandra/db/ReadCommand.java | 8 +++-----
src/java/org/apache/cassandra/db/ReadResponse.java | 11 ++++-------
3 files changed, 8 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/932f3ebb/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 798496a..459d591 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
3.0.9
+ * Fix paging for 2.x to 3.x upgrades (CASSANDRA-11195)
* select_distinct_with_deletions_test failing on non-vnode environments (CASSANDRA-11126)
* Stack Overflow returned to queries while upgrading (CASSANDRA-12527)
* Fix legacy regex for temporary files from 2.2 (CASSANDRA-12565)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/932f3ebb/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 c1762f1..70c770d 100644
--- a/src/java/org/apache/cassandra/db/ReadCommand.java
+++ b/src/java/org/apache/cassandra/db/ReadCommand.java
@@ -1016,7 +1016,7 @@ public abstract class ReadCommand implements ReadQuery
// slice filter's stop.
DataRange.Paging pagingRange = (DataRange.Paging) rangeCommand.dataRange();
Clustering lastReturned = pagingRange.getLastReturned();
- Slice.Bound newStart = Slice.Bound.exclusiveStartOf(lastReturned);
+ Slice.Bound newStart = Slice.Bound.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);
@@ -1025,10 +1025,8 @@ public abstract class ReadCommand 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/932f3ebb/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 2304cb4..12f0b15 100644
--- a/src/java/org/apache/cassandra/db/ReadResponse.java
+++ b/src/java/org/apache/cassandra/db/ReadResponse.java
@@ -280,13 +280,10 @@ 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 = filter.filter(partition.sliceableUnfilteredIterator(command.columnFilter(), 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. By consequence, we need to filter
+ // the results here.
+ UnfilteredRowIterator iterator = filter.filter(partition.sliceableUnfilteredIterator(command.columnFilter(), filter.isReversed()));
// Wrap results with a ThriftResultMerger only if they're intended for the thrift command.
if (command.isForThrift())
[2/4] cassandra git commit: Fix paging for 2.x to 3.x upgrades
Posted by bl...@apache.org.
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/trunk
Commit: c11c7d73d086f89521805ce7cc1907d5788ab969
Parents: 6facdf0
Author: Benjamin Lerer <b....@gmail.com>
Authored: Mon Sep 12 10:37:27 2016 +0200
Committer: Benjamin Lerer <b....@gmail.com>
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())
[3/4] cassandra git commit: Merge branch cassandra-3.0 into trunk
Posted by bl...@apache.org.
Merge branch cassandra-3.0 into trunk
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/301d5ef5
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/301d5ef5
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/301d5ef5
Branch: refs/heads/trunk
Commit: 301d5ef55e34c6c7402d1d382db23bd2ca947a03
Parents: f0b229a 932f3eb
Author: Benjamin Lerer <b....@gmail.com>
Authored: Mon Sep 12 10:46:57 2016 +0200
Committer: Benjamin Lerer <b....@gmail.com>
Committed: Mon Sep 12 10:47:11 2016 +0200
----------------------------------------------------------------------
----------------------------------------------------------------------
[4/4] cassandra git commit: Merge branch cassandra-3.9 into trunk
Posted by bl...@apache.org.
Merge branch cassandra-3.9 into trunk
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/4354db24
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/4354db24
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/4354db24
Branch: refs/heads/trunk
Commit: 4354db24ce44dcc231a2174f82f4bc8db0e0de94
Parents: 301d5ef c11c7d7
Author: Benjamin Lerer <b....@gmail.com>
Authored: Mon Sep 12 10:50:40 2016 +0200
Committer: Benjamin Lerer <b....@gmail.com>
Committed: Mon Sep 12 10:50:40 2016 +0200
----------------------------------------------------------------------
CHANGES.txt | 1 +
.../apache/cassandra/cql3/statements/SelectStatement.java | 1 +
src/java/org/apache/cassandra/db/ReadCommand.java | 8 +++-----
src/java/org/apache/cassandra/db/ReadResponse.java | 10 +++-------
4 files changed, 8 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/4354db24/CHANGES.txt
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/4354db24/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/4354db24/src/java/org/apache/cassandra/db/ReadCommand.java
----------------------------------------------------------------------