Optimize sstable::as_mutation_source() for one partition
Although usually one can fast_forward_to() on the result of a sstable::as_mutation_source(), earlier we had an optimization where if a single partition was specified, it was read exactly, and fast_forward_to() was *NOT* allowed. With the mutation_reader::forwarding flag patch, when this flag was on - requesting fast_forward_to() - we disabled this optimization. This makes sense, but is not backward compatible with the code which previously assumes this optimization exists... So this patch returns this optimization, despite this meaning that we blatently ignore the fwd_mr flag in that case. Signed-off-by: Nadav Har'El <nyh@scylladb.com> Message-Id: <20170620081107.14335-1-nyh@scylladb.com>
This commit is contained in:
committed by
Tomasz Grabiec
parent
ba0ba87bf9
commit
186f031187
@@ -2826,7 +2826,11 @@ mutation_source sstable::as_mutation_source() {
|
||||
tracing::trace_state_ptr trace_ptr,
|
||||
streamed_mutation::forwarding fwd,
|
||||
::mutation_reader::forwarding fwd_mr) mutable {
|
||||
if (!fwd_mr && range.is_singular() && range.start()->value().has_key()) {
|
||||
// CAVEAT: if as_mutation_source() is called on a single partition
|
||||
// we want to optimize and read exactly this partition. As a
|
||||
// consequence, fast_forward_to() will *NOT* work on the result,
|
||||
// regardless of what the fwd_mr parameter says.
|
||||
if (range.is_singular() && range.start()->value().has_key()) {
|
||||
const dht::ring_position& pos = range.start()->value();
|
||||
return make_mutation_reader<single_partition_reader_adaptor>(sst, s, pos, slice, pc, fwd);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user