diff --git a/gms/gossiper.cc b/gms/gossiper.cc index 2341faf843..30b6e1ac43 100644 --- a/gms/gossiper.cc +++ b/gms/gossiper.cc @@ -2331,31 +2331,6 @@ std::string_view gossiper::get_gossip_status(const locator::host_id& endpoint) c return do_get_gossip_status(get_application_state_ptr(endpoint, application_state::STATUS)); } -bool gossiper::is_safe_for_bootstrap(inet_address endpoint) const { - // We allow to bootstrap a new node in only two cases: - // 1) The node is a completely new node and no state in gossip at all - // 2) The node has state in gossip and it is already removed from the - // cluster either by nodetool decommission or nodetool removenode - bool allowed = true; - auto host_id = try_get_host_id(endpoint); - if (!host_id) { - logger.debug("is_safe_for_bootstrap: node={}, status=no state in gossip, allowed_to_bootstrap={}", endpoint, allowed); - return allowed; - } - auto eps = get_endpoint_state_ptr(*host_id); - if (!eps) { - logger.debug("is_safe_for_bootstrap: node={}, status=no state in gossip, allowed_to_bootstrap={}", endpoint, allowed); - return allowed; - } - auto status = get_gossip_status(*eps); - std::unordered_set allowed_statuses{ - versioned_value::STATUS_LEFT, - }; - allowed = allowed_statuses.contains(status); - logger.debug("is_safe_for_bootstrap: node={}, status={}, allowed_to_bootstrap={}", endpoint, status, allowed); - return allowed; -} - std::set gossiper::get_supported_features(locator::host_id endpoint) const { auto app_state = get_application_state_ptr(endpoint, application_state::SUPPORTED_FEATURES); if (!app_state) { diff --git a/gms/gossiper.hh b/gms/gossiper.hh index d28f64d74c..d2482ccb46 100644 --- a/gms/gossiper.hh +++ b/gms/gossiper.hh @@ -352,7 +352,6 @@ public: future get_current_generation_number(locator::host_id endpoint) const; future get_current_heart_beat_version(locator::host_id endpoint) const; - bool is_safe_for_bootstrap(inet_address endpoint) const; private: /** * Returns true if the chosen target was also a seed. False otherwise diff --git a/service/storage_service.cc b/service/storage_service.cc index c2abbc1c42..39b849c75a 100644 --- a/service/storage_service.cc +++ b/service/storage_service.cc @@ -1551,9 +1551,7 @@ future<> storage_service::join_topology(sharded& proxy, raft_replace_info = raft_group0::replace_info { .raft_id = raft::server_id{ri->host_id.uuid()}, }; - } else if (!_sys_ks.local().bootstrap_complete()) { - co_await check_for_endpoint_collision(initial_contact_nodes); - } else { + } else if (_sys_ks.local().bootstrap_complete()) { slogger.info("Performing gossip shadow round, initial_contact_nodes={}", initial_contact_nodes); co_await _gossiper.do_shadow_round(initial_contact_nodes, gms::gossiper::mandatory::no); _gossiper.check_snitch_name_matches(_snitch.local()->get_name()); @@ -2401,27 +2399,6 @@ future<> storage_service::wait_for_group0_stop() { } } -future<> storage_service::check_for_endpoint_collision(std::unordered_set initial_contact_nodes) { - slogger.debug("Starting shadow gossip round to check for endpoint collision"); - - return seastar::async([this, initial_contact_nodes] { - bool found_bootstrapping_node = false; - auto local_features = _feature_service.supported_feature_set(); - do { - slogger.info("Performing gossip shadow round"); - _gossiper.do_shadow_round(initial_contact_nodes, gms::gossiper::mandatory::yes).get(); - _gossiper.check_snitch_name_matches(_snitch.local()->get_name()); - auto addr = get_broadcast_address(); - if (!_gossiper.is_safe_for_bootstrap(addr)) { - throw std::runtime_error(::format("A node with address {} already exists, cancelling join. " - "Use replace_address if you want to replace this node.", addr)); - } - } while (found_bootstrapping_node); - slogger.info("Checking bootstrapping/leaving/moving nodes: ok (check_for_endpoint_collision)"); - _gossiper.reset_endpoint_state_map().get(); - }); -} - future<> storage_service::remove_endpoint(inet_address endpoint, gms::permit_id pid) { auto host_id_opt = _gossiper.try_get_host_id(endpoint); if (host_id_opt) { diff --git a/service/storage_service.hh b/service/storage_service.hh index 26c2a44ddb..655f4661fb 100644 --- a/service/storage_service.hh +++ b/service/storage_service.hh @@ -474,8 +474,6 @@ private: public: - future<> check_for_endpoint_collision(std::unordered_set initial_contact_nodes); - future<> join_cluster(sharded& proxy, start_hint_manager start_hm, gms::generation_type new_generation);