mirror of https://github.com/apache/cassandra
Fix potential exception in SSTableIterator indexed reader
patch by carlyeks; reviewed by slebresne for CASSANDRA-9859
This commit is contained in:
parent
2457599427
commit
9ddce25ff7
|
|
@ -3,7 +3,7 @@
|
||||||
* Metrics should use up to date nomenclature (CASSANDRA-9448)
|
* Metrics should use up to date nomenclature (CASSANDRA-9448)
|
||||||
* Change CREATE/ALTER TABLE syntax for compression (CASSANDRA-8384)
|
* Change CREATE/ALTER TABLE syntax for compression (CASSANDRA-8384)
|
||||||
* Cleanup crc and adler code for java 8 (CASSANDRA-9650)
|
* Cleanup crc and adler code for java 8 (CASSANDRA-9650)
|
||||||
* Storage engine refactor (CASSANDRA-8099, 9743, 9746, 9759, 9781, 9808, 9825, 9848)
|
* Storage engine refactor (CASSANDRA-8099, 9743, 9746, 9759, 9781, 9808, 9825, 9848, 9705, 9859)
|
||||||
* Update Guava to 18.0 (CASSANDRA-9653)
|
* Update Guava to 18.0 (CASSANDRA-9653)
|
||||||
* Bloom filter false positive ratio is not honoured (CASSANDRA-8413)
|
* Bloom filter false positive ratio is not honoured (CASSANDRA-8413)
|
||||||
* New option for cassandra-stress to leave a ratio of columns null (CASSANDRA-9522)
|
* New option for cassandra-stress to leave a ratio of columns null (CASSANDRA-9522)
|
||||||
|
|
|
||||||
|
|
@ -456,7 +456,7 @@ abstract class AbstractSSTableIterator implements SliceableUnfilteredRowIterator
|
||||||
// Check if we've crossed an index boundary (based on the mark on the beginning of the index block).
|
// Check if we've crossed an index boundary (based on the mark on the beginning of the index block).
|
||||||
public boolean isPastCurrentBlock()
|
public boolean isPastCurrentBlock()
|
||||||
{
|
{
|
||||||
return currentIndexIdx < indexes.size() && reader.file.bytesPastMark(mark) >= currentIndex().width;
|
return reader.file.bytesPastMark(mark) >= currentIndex().width;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int currentBlockIdx()
|
public int currentBlockIdx()
|
||||||
|
|
|
||||||
|
|
@ -252,8 +252,9 @@ public class SSTableIterator extends AbstractSSTableIterator
|
||||||
protected Unfiltered computeNext() throws IOException
|
protected Unfiltered computeNext() throws IOException
|
||||||
{
|
{
|
||||||
// Our previous read might have made us cross an index block boundary. If so, update our informations.
|
// Our previous read might have made us cross an index block boundary. If so, update our informations.
|
||||||
if (indexState.isPastCurrentBlock())
|
int currentBlockIdx = indexState.currentBlockIdx();
|
||||||
indexState.setToBlock(indexState.currentBlockIdx() + 1);
|
if (indexState.isPastCurrentBlock() && currentBlockIdx + 1 < indexState.blocksCount())
|
||||||
|
indexState.setToBlock(currentBlockIdx + 1);
|
||||||
|
|
||||||
// Return the next unfiltered unless we've reached the end, or we're beyond our slice
|
// Return the next unfiltered unless we've reached the end, or we're beyond our slice
|
||||||
// end (note that unless we're on the last block for the slice, there is no point
|
// end (note that unless we're on the last block for the slice, there is no point
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue