Updated Branches: refs/heads/trunk 8f17bbd0d -> 82571546e
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/0be42463 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/0be42463 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/0be42463 Branch: refs/heads/trunk Commit: 0be42463b756ede298c099cf1661f02e198b3344 Parents: 2f86648 Author: Sylvain Lebresne <sylv...@datastax.com> Authored: Wed Jan 29 19:19:55 2014 +0100 Committer: Sylvain Lebresne <sylv...@datastax.com> Committed: Wed Jan 29 19:20:55 2014 +0100 ---------------------------------------------------------------------- CHANGES.txt | 1 + src/java/org/apache/cassandra/db/DataRange.java | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/0be42463/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index c626d37..ed32385 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -12,6 +12,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/0be42463/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 713027c..b8e0bf5 100644 --- a/src/java/org/apache/cassandra/db/DataRange.java +++ b/src/java/org/apache/cassandra/db/DataRange.java @@ -184,8 +184,11 @@ 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 - ByteBuffer newStart = equals(startKey(), key) ? columnStart : null; - ByteBuffer newFinish = equals(stopKey(), key) ? columnFinish : null; + // Also note that columnStart and columnFinish, when used, only "restrict" the filter slices, + // 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) + ByteBuffer newStart = equals(startKey(), key) && columnStart.hasRemaining() ? columnStart : null; + ByteBuffer newFinish = equals(stopKey(), key) && columnFinish.hasRemaining() ? columnFinish : null; List<ColumnSlice> newSlices = new ArrayList<ColumnSlice>(sliceFilter.slices.length); // in the common case, we'll have the same number of slices