From 65e488c150ff019bf8279039af3a77b29330e00a Mon Sep 17 00:00:00 2001 From: Tomasz Grabiec Date: Fri, 25 Aug 2017 20:24:36 +0200 Subject: [PATCH] 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. --- sstables/partition.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sstables/partition.cc b/sstables/partition.cc index e1efbc8e26..3f773121bf 100644 --- a/sstables/partition.cc +++ b/sstables/partition.cc @@ -1149,6 +1149,10 @@ future<> sstable_data_source::advance_to_next_partition() { future 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(); + } return advance_to_next_partition().then([this] { return read_partition(); });