Skip to content

Commit

Permalink
Merge 'repair: accelerate repair load_history time' from Xu Chang
Browse files Browse the repository at this point in the history
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: #16774

Closes #16927

* github.com:scylladb/scylladb:
  repair: resolve load_history shard load skew
  repair: accelerate repair load_history time
  • Loading branch information
denesb committed Feb 20, 2024
2 parents b0bb3ab + 9b675d1 commit 8c228bf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions repair/row_level.cc
Expand Up @@ -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<> {
Expand Down
1 change: 1 addition & 0 deletions repair/row_level.hh
Expand Up @@ -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();
Expand Down

0 comments on commit 8c228bf

Please sign in to comment.