You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by jb...@apache.org on 2012/11/12 22:59:50 UTC
[5/8] git commit: reset getRangeSlice filter after finishing a row forget_paged_slice patch by Piotr Kołaczkowski; reviewed by jbellis for CASSANDRA-4919
reset getRangeSlice filter after finishing a row forget_paged_slice
patch by Piotr Kołaczkowski; reviewed by jbellis for CASSANDRA-4919
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/a2ca30e7
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/a2ca30e7
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/a2ca30e7
Branch: refs/heads/trunk
Commit: a2ca30e79510a04ca1f6b9c5a342ee9467176a9f
Parents: a05f676
Author: Jonathan Ellis <jb...@apache.org>
Authored: Mon Nov 12 15:57:15 2012 -0600
Committer: Jonathan Ellis <jb...@apache.org>
Committed: Mon Nov 12 15:57:15 2012 -0600
----------------------------------------------------------------------
CHANGES.txt | 2 +
.../org/apache/cassandra/service/StorageProxy.java | 17 ++++++++++++++-
2 files changed, 18 insertions(+), 1 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a2ca30e7/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 088daa7..b80c60f 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,6 @@
1.1.7
+ * reset getRangeSlice filter after finishing a row for get_paged_slice
+ (CASSANDRA-4919)
* expunge row cache post-truncate (CASSANDRA-4940)
* remove IAuthority2 (CASSANDRA-4875)
* add get[Row|Key]CacheEntries to CacheServiceMBean (CASSANDRA-4859)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/a2ca30e7/src/java/org/apache/cassandra/service/StorageProxy.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/StorageProxy.java b/src/java/org/apache/cassandra/service/StorageProxy.java
index 14466ee..453e2b2 100644
--- a/src/java/org/apache/cassandra/service/StorageProxy.java
+++ b/src/java/org/apache/cassandra/service/StorageProxy.java
@@ -845,6 +845,9 @@ public class StorageProxy implements StorageProxyMBean
// now scan until we have enough results
try
{
+ final SlicePredicate emptyPredicate = getEmptySlicePredicate();
+ SlicePredicate commandPredicate = command.predicate;
+
int columnsCount = 0;
rows = new ArrayList<Row>();
List<AbstractBounds<RowPosition>> ranges = getRestrictedRanges(command.range);
@@ -853,7 +856,7 @@ public class StorageProxy implements StorageProxyMBean
RangeSliceCommand nodeCmd = new RangeSliceCommand(command.keyspace,
command.column_family,
command.super_column,
- command.predicate,
+ commandPredicate,
range,
command.row_filter,
command.maxResults,
@@ -923,6 +926,11 @@ public class StorageProxy implements StorageProxyMBean
int count = nodeCmd.maxIsColumns ? columnsCount : rows.size();
if (count >= nodeCmd.maxResults)
break;
+
+ // if we are paging and already got some rows, reset the column filter predicate,
+ // so we start iterating the next row from the first column
+ if (!rows.isEmpty() && command.isPaging)
+ commandPredicate = emptyPredicate;
}
}
finally
@@ -932,6 +940,13 @@ public class StorageProxy implements StorageProxyMBean
return trim(command, rows);
}
+ private static SlicePredicate getEmptySlicePredicate()
+ {
+ final SliceRange emptySliceRange =
+ new SliceRange(ByteBufferUtil.EMPTY_BYTE_BUFFER, ByteBufferUtil.EMPTY_BYTE_BUFFER, false, -1);
+ return new SlicePredicate().setSlice_range(emptySliceRange);
+ }
+
private static List<Row> trim(RangeSliceCommand command, List<Row> rows)
{
// When maxIsColumns, we let the caller trim the result.