sstables: Fix abort in mutation reader for certain skip pattern

The problem happens for the following sequence of events:

 1) reader stops in the middle of some partition before it
    skips to another partition range

 2) reader is fast forwarded to a partition range which has no data in
    the sstable. There are some partitions between the previous
    partition range and the one we skip to

 3) the reader is asked for next partition

The problem was that mutation_reader::fast_forward_to() was putting
the reader in _read_enabled == false state in step 2, but
data_consume_context was not fast forwarded to the range. When in step
3 we were asked for the next partition, we attempted to skip using
index (because of 1). The result of the skip was some position which
is outside of the current range of data_consume_context, which causes
it to abort. To fix, add a check for _read_enabled before we try to
skip.
This commit is contained in:
Tomasz Grabiec
2017-08-25 20:24:36 +02:00
parent dc3c8863f3
commit 65e488c150

View File

@@ -1149,6 +1149,10 @@ future<> sstable_data_source::advance_to_next_partition() {
future<streamed_mutation_opt> sstable_data_source::read_next_partition() {
sstlog.trace("reader {}: read next partition", this);
if (!_read_enabled) {
sstlog.trace("reader {}: eof", this);
return make_ready_future<streamed_mutation_opt>();
}
return advance_to_next_partition().then([this] {
return read_partition();
});