Merge 'repair: accelerate repair load_history time' from Xu Chang

Using `parallel_for_each_table` instance of `for_each_table_gently` on
`repair_service::load_history`, to reduced bootstrap time.
Using uuid_xor_to_uint32 on repair load_history dispatch to shard.

Ref: https://github.com/scylladb/scylladb/issues/16774

Closes scylladb/scylladb#16927

* github.com:scylladb/scylladb:
  repair: resolve load_history shard load skew
  repair: accelerate repair load_history time
This commit is contained in:
Botond Dénes
2024-02-20 13:45:26 +02:00
2 changed files with 5 additions and 2 deletions

View File

@@ -3230,11 +3230,13 @@ future<> repair_service::cleanup_history(tasks::task_id repair_id) {
}
future<> repair_service::load_history() {
co_await get_db().local().get_tables_metadata().for_each_table_gently(coroutine::lambda([&] (table_id table_uuid, lw_shared_ptr<replica::table> table) -> future<> {
auto shard = unsigned(table_uuid.uuid().get_most_significant_bits()) % smp::count;
co_await get_db().local().get_tables_metadata().parallel_for_each_table(coroutine::lambda([&] (table_id table_uuid, lw_shared_ptr<replica::table> table) -> future<> {
auto shard = utils::uuid_xor_to_uint32(table_uuid.uuid()) % smp::count;
if (shard != this_shard_id()) {
co_return;
}
auto permit = co_await seastar::get_units(_load_parallelism_semaphore, 1);
rlogger.info("Loading repair history for keyspace={}, table={}, table_uuid={}",
table->schema()->ks_name(), table->schema()->cf_name(), table_uuid);
co_await _sys_ks.local().get_repair_history(table_uuid, [this] (const auto& entry) -> future<> {

View File

@@ -108,6 +108,7 @@ class repair_service : public seastar::peering_sharded_service<repair_service> {
size_t _max_repair_memory;
seastar::semaphore _memory_sem;
seastar::named_semaphore _load_parallelism_semaphore = {16, named_semaphore_exception_factory{"Load repair history parallelism"}};
future<> init_ms_handlers();
future<> uninit_ms_handlers();