Skip to content

Commit

Permalink
repair: resolve load_history shard load skew
Browse files Browse the repository at this point in the history
Using uuid_xor_to_uint32 instance of table_uuid's most_significant_bits,
optimize the hash conflict to shard.
  • Loading branch information
MyByte0 committed Feb 8, 2024
1 parent ae422fd commit 9b675d1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion repair/row_level.cc
Expand Up @@ -3230,7 +3230,7 @@ future<> repair_service::cleanup_history(tasks::task_id repair_id) {

future<> repair_service::load_history() {
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 = unsigned(table_uuid.uuid().get_most_significant_bits()) % smp::count;
auto shard = utils::uuid_xor_to_uint32(table_uuid.uuid()) % smp::count;
if (shard != this_shard_id()) {
co_return;
}
Expand Down

0 comments on commit 9b675d1

Please sign in to comment.