From aaf74776c271ea613247375e1eb8efca1bb9a3b3 Mon Sep 17 00:00:00 2001 From: Benny Halevy Date: Tue, 15 Nov 2022 19:14:02 +0200 Subject: [PATCH] repair: do_repair_start: use keyspace erm for get_primary_ranges Ensure that the primary ranges are in sync with the keyspace erm. The function is synchronous so this change doesn't fix anything, it just cleans up the code. Signed-off-by: Benny Halevy --- repair/repair.cc | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/repair/repair.cc b/repair/repair.cc index 0f0c606929..6a936d8c2d 100644 --- a/repair/repair.cc +++ b/repair/repair.cc @@ -675,17 +675,6 @@ future<> repair_info::repair_range(const dht::token_range& range, ::table_id tab }); } -static dht::token_range_vector get_primary_ranges_for_endpoint( - replica::database& db, sstring keyspace, gms::inet_address ep) { - return db.find_keyspace(keyspace).get_effective_replication_map()->get_primary_ranges(ep); -} - -static dht::token_range_vector get_primary_ranges( - replica::database& db, sstring keyspace) { - return get_primary_ranges_for_endpoint(db, keyspace, - utils::fb_utilities::get_broadcast_address()); -} - void repair_stats::add(const repair_stats& o) { round_nr += o.round_nr; round_nr_fast_path_already_synced += o.round_nr_fast_path_already_synced; @@ -1042,7 +1031,7 @@ int repair_service::do_repair_start(sstring keyspace, std::unordered_map 0 || options.hosts.size() > 0) { throw std::runtime_error("You need to run primary range repair on all nodes in the cluster."); } else { - ranges = get_primary_ranges(db, keyspace); + ranges = erm->get_primary_ranges(utils::fb_utilities::get_broadcast_address()); } } else { ranges = db.get_keyspace_local_ranges(keyspace);