repair/row_level: set max buffer size on multishard reader

The multishard reader is used in the mixed-shard case, when a repair has
to read from all other shards. It is very important that cross-shard
roundtrips and possible evict-recreate cycles for the shard readers is
avoided. For this end, make use of the recently introduced internal
buffer hint feature in the multishard reader and set it's buffer size to
match that of the row level repair buffer size.

The use of the buffer-hint can be controlled with the recently
introduced repair_multishard_reader_buffer_hint_size config param.
This commit is contained in:
Botond Dénes
2024-11-06 09:01:55 -05:00
parent e2344e28b6
commit 784f89f585

View File

@@ -297,13 +297,21 @@ mutation_reader repair_reader::make_reader(
return rd;
}
case read_strategy::multishard_split: {
std::optional<size_t> multishard_reader_buffer_size;
const auto& dbconfig = db.local().get_config();
if (dbconfig.repair_multishard_reader_buffer_hint_size()) {
// Setting the repair buffer size as the multishard reader's buffer
// size helps avoid extra cross-shard round-trips and possible
// evict-recreate cycles.
multishard_reader_buffer_size = dbconfig.repair_multishard_reader_buffer_hint_size();
}
return make_multishard_streaming_reader(db, _schema, _permit, [this] {
auto shard_range = _sharder.next();
if (shard_range) {
return std::optional<dht::partition_range>(dht::to_partition_range(*shard_range));
}
return std::optional<dht::partition_range>();
}, compaction_time, {});
}, compaction_time, multishard_reader_buffer_size);
}
case read_strategy::multishard_filter: {
return make_filtering_reader(make_multishard_streaming_reader(db, _schema, _permit, _range, compaction_time, {}),