mirror of https://github.com/apache/cassandra
Fix repeated slices on AbstractThreadUnsafePartition.SliceableIterator
Patch by Tyler Hobbs; reviewed by Stefania Alborghetti for CASSANDRA-10002
This commit is contained in:
parent
a8b8515c84
commit
e5e2910443
|
|
@ -1,4 +1,5 @@
|
|||
3.0.0-beta1
|
||||
* Fix multiple slices on RowSearchers (CASSANDRA-10002)
|
||||
* Fix bug in merging of collections (CASSANDRA-10001)
|
||||
* Optimize batchlog replay to avoid full scans (CASSANDRA-7237)
|
||||
* Repair improvements when using vnodes (CASSANDRA-5220)
|
||||
|
|
|
|||
|
|
@ -325,11 +325,17 @@ public abstract class AbstractThreadUnsafePartition implements Partition, Iterab
|
|||
// Note that because a Slice.Bound can never sort equally to a Clustering, we know none of the search will
|
||||
// be a match, so we save from testing for it.
|
||||
|
||||
final int start = -search(slice.start(), nextIdx, rows.size()) - 1; // First index to include
|
||||
// since the binary search starts from nextIdx, the position returned will be an offset from nextIdx; to
|
||||
// get an absolute position, add nextIdx back in
|
||||
int searchResult = search(slice.start(), nextIdx, rows.size());
|
||||
final int start = nextIdx + (-searchResult - 1); // First index to include
|
||||
|
||||
if (start >= rows.size())
|
||||
return Collections.emptyIterator();
|
||||
|
||||
final int end = -search(slice.end(), start, rows.size()) - 1; // First index to exclude
|
||||
// similarly, add start to the returned position
|
||||
searchResult = search(slice.end(), start, rows.size());
|
||||
final int end = start + (-searchResult - 1); // First index to exclude
|
||||
|
||||
// Remember the end to speed up potential further slice search
|
||||
nextIdx = end;
|
||||
|
|
|
|||
Loading…
Reference in New Issue