diff --git a/cdc/generation.cc b/cdc/generation.cc index a881a74d6a..cca12927cc 100644 --- a/cdc/generation.cc +++ b/cdc/generation.cc @@ -194,10 +194,9 @@ static std::vector create_stream_ids( return result; } -bool should_propose_first_generation(const gms::inet_address& me, const gms::gossiper& g) { - auto my_host_id = g.get_host_id(me); - return g.for_each_endpoint_state_until([&] (const gms::inet_address& node, const gms::endpoint_state& eps) { - return stop_iteration(my_host_id < g.get_host_id(node)); +bool should_propose_first_generation(const locator::host_id& my_host_id, const gms::gossiper& g) { + return g.for_each_endpoint_state_until([&] (const gms::inet_address&, const gms::endpoint_state& eps) { + return stop_iteration(my_host_id < eps.get_host_id()); }) == stop_iteration::no; } diff --git a/cdc/generation.hh b/cdc/generation.hh index a4f34db5df..8cfb18613c 100644 --- a/cdc/generation.hh +++ b/cdc/generation.hh @@ -133,7 +133,7 @@ public: * The chosen condition is arbitrary, it only tries to make sure that no two nodes propose a generation of streams * when upgrading, and nothing bad happens if they for some reason do (it's mostly an optimization). */ -bool should_propose_first_generation(const gms::inet_address& me, const gms::gossiper&); +bool should_propose_first_generation(const locator::host_id& me, const gms::gossiper&); /* * Checks if the CDC generation is optimal, which is true if its `topology_description` is consistent diff --git a/service/storage_service.cc b/service/storage_service.cc index 22a9607b16..c01801e7ba 100644 --- a/service/storage_service.cc +++ b/service/storage_service.cc @@ -1798,7 +1798,7 @@ future<> storage_service::join_token_ring(sharded storage_service::start_maintenance_mode() { set_mode(mode::MAINTENANCE); return mutate_token_metadata([this] (mutable_token_metadata_ptr token_metadata) -> future<> { - return token_metadata->update_normal_tokens({ dht::token{} }, get_token_metadata_ptr()->get_topology().my_host_id()); + return token_metadata->update_normal_tokens({ dht::token{} }, my_host_id()); }, acquire_merge_lock::yes); } diff --git a/service/storage_service.hh b/service/storage_service.hh index 4b43a8c559..578105a137 100644 --- a/service/storage_service.hh +++ b/service/storage_service.hh @@ -284,6 +284,9 @@ private: inet_address get_broadcast_address() const noexcept { return get_token_metadata_ptr()->get_topology().my_address(); } + locator::host_id my_host_id() const noexcept { + return get_token_metadata_ptr()->get_topology().my_host_id(); + } bool is_me(inet_address addr) const noexcept { return get_token_metadata_ptr()->get_topology().is_me(addr); }