Make sure mutation_reader for sstables can be fast-forwarded

Fixes #2145.

Signed-off-by: Piotr Jastrzebski <piotr@scylladb.com>
[tgrabiec: Extracted from a series, fixed title]
Message-Id: <1495639745-19387-1-git-send-email-tgrabiec@scylladb.com>
This commit is contained in:
Piotr Jastrzebski
2017-05-24 17:29:05 +02:00
committed by Paweł Dziepak
parent 6cf2841654
commit 6528f3a963

View File

@@ -1105,7 +1105,15 @@ public:
}
future<> fast_forward_to(const dht::partition_range& pr) {
return _ds->fast_forward_to(pr);
if (_ds) {
return _ds->fast_forward_to(pr);
}
return (_get_data_source)().then([this, &pr] (lw_shared_ptr<sstable_data_source> ds) {
// We must get the sstable_data_source and backup it in case we enable read
// again in the future.
_ds = std::move(ds);
return _ds->fast_forward_to(pr);
});
}
};