Updated Branches: refs/heads/trunk bc03437fe -> 8f17bbd0d
Fix ArrayIndexOutOfBoundsException in 2ndary index query patch by slebresne; reviewed by lyubent for CASSANDRA-6470 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/8f17bbd0 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/8f17bbd0 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/8f17bbd0 Branch: refs/heads/trunk Commit: 8f17bbd0d31cec0625c67c5c419c1fa78b052035 Parents: bc03437 Author: Sylvain Lebresne <[email protected]> Authored: Wed Jan 29 19:19:55 2014 +0100 Committer: Sylvain Lebresne <[email protected]> Committed: Wed Jan 29 19:28:28 2014 +0100 ---------------------------------------------------------------------- CHANGES.txt | 1 + src/java/org/apache/cassandra/db/DataRange.java | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/8f17bbd0/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index d55b658..c7592fb 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -41,6 +41,7 @@ * Fix NPE when streaming connection is not yet established (CASSANDRA-6210) * Avoid rare duplicate read repair triggering (CASSANDRA-6606) * Fix paging discardFirst (CASSANDRA-6555) + * Fix ArrayIndexOutOfBoundsException in 2ndary index query (CASSANDRA-6470) Merged from 1.2: * fsync compression metadata (CASSANDRA-6531) * Validate CF existence on execution for prepared statement (CASSANDRA-6535) http://git-wip-us.apache.org/repos/asf/cassandra/blob/8f17bbd0/src/java/org/apache/cassandra/db/DataRange.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/db/DataRange.java b/src/java/org/apache/cassandra/db/DataRange.java index 453b16a..91ff512 100644 --- a/src/java/org/apache/cassandra/db/DataRange.java +++ b/src/java/org/apache/cassandra/db/DataRange.java @@ -185,8 +185,10 @@ public class DataRange private ColumnSlice[] slicesForKey(ByteBuffer key) { // We don't call that until it's necessary, so assume we have to do some hard work - Composite newStart = equals(startKey(), key) ? columnStart : null; - Composite newFinish = equals(stopKey(), key) ? columnFinish : null; + // it doesn't expand on them. As such, we can ignore the case where they are empty and we do + // as it screw up with the logic below (see #6592) + Composite newStart = equals(startKey(), key) && !columnStart.isEmpty() ? columnStart : null; + Composite newFinish = equals(stopKey(), key) && !columnFinish.isEmpty() ? columnFinish : null; List<ColumnSlice> newSlices = new ArrayList<ColumnSlice>(sliceFilter.slices.length); // in the common case, we'll have the same number of slices
