From 784f89f5858728791237b5bf9223be80efbb9679 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Botond=20D=C3=A9nes?= Date: Wed, 6 Nov 2024 09:01:55 -0500 Subject: [PATCH] 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. --- repair/row_level.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/repair/row_level.cc b/repair/row_level.cc index 4040735acb..67b921256f 100644 --- a/repair/row_level.cc +++ b/repair/row_level.cc @@ -297,13 +297,21 @@ mutation_reader repair_reader::make_reader( return rd; } case read_strategy::multishard_split: { + std::optional 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::to_partition_range(*shard_range)); } return std::optional(); - }, 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, {}),