mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-12 19:02:12 +00:00
make_foreign_reader: don't wrap local readers
If the to-be-wrapped reader is local (lives on the same shard where make_foreign_reader() is called) there is no need to wrap it with foreign_reader. Just return it as is. Signed-off-by: Botond Dénes <bdenes@scylladb.com> Message-Id: <886ed883b707f163603a40b56b8823f2bb6c47c6.1523873224.git.bdenes@scylladb.com>
This commit is contained in:
@@ -977,6 +977,9 @@ future<> foreign_reader::fast_forward_to(position_range pr, db::timeout_clock::t
|
||||
flat_mutation_reader make_foreign_reader(schema_ptr schema,
|
||||
foreign_ptr<std::unique_ptr<flat_mutation_reader>> reader,
|
||||
streamed_mutation::forwarding fwd_sm) {
|
||||
if (reader.get_owner_shard() == engine().cpu_id()) {
|
||||
return std::move(*reader);
|
||||
}
|
||||
return make_flat_mutation_reader<foreign_reader>(std::move(schema), std::move(reader), fwd_sm);
|
||||
}
|
||||
|
||||
|
||||
@@ -381,6 +381,9 @@ stable_flattened_mutations_consumer<FlattenedConsumer> make_stable_flattened_mut
|
||||
/// fast_forward_to() a read-ahead (a fill_buffer() on the remote reader) is
|
||||
/// issued. This read-ahead runs in the background and is brough back to
|
||||
/// foreground on the next fill_buffer() or fast_forward_to() call.
|
||||
/// If the reader resides on this shard (the shard where make_foreign_reader()
|
||||
/// is called) there is no need to wrap it in foreign_reader, just return it as
|
||||
/// is.
|
||||
flat_mutation_reader make_foreign_reader(schema_ptr schema,
|
||||
foreign_ptr<std::unique_ptr<flat_mutation_reader>> reader,
|
||||
streamed_mutation::forwarding fwd_sm = streamed_mutation::forwarding::no);
|
||||
|
||||
Reference in New Issue
Block a user