diff --git a/gms/versioned_value.cc b/gms/versioned_value.cc index af270b6e09..43196a84fb 100644 --- a/gms/versioned_value.cc +++ b/gms/versioned_value.cc @@ -24,7 +24,6 @@ constexpr const char versioned_value::DELIMITER_STR[]; constexpr const char* versioned_value::STATUS_UNKNOWN; constexpr const char* versioned_value::STATUS_BOOTSTRAPPING; constexpr const char* versioned_value::STATUS_NORMAL; -constexpr const char* versioned_value::STATUS_LEAVING; constexpr const char* versioned_value::STATUS_LEFT; constexpr const char* versioned_value::STATUS_MOVING; constexpr const char* versioned_value::REMOVED_TOKEN; diff --git a/gms/versioned_value.hh b/gms/versioned_value.hh index 6b1253eab7..0c6e744b3b 100644 --- a/gms/versioned_value.hh +++ b/gms/versioned_value.hh @@ -47,7 +47,6 @@ public: static constexpr const char* STATUS_UNKNOWN = "UNKNOWN"; static constexpr const char* STATUS_BOOTSTRAPPING = "BOOT"; static constexpr const char* STATUS_NORMAL = "NORMAL"; - static constexpr const char* STATUS_LEAVING = "LEAVING"; static constexpr const char* STATUS_LEFT = "LEFT"; static constexpr const char* STATUS_MOVING = "MOVING"; @@ -127,11 +126,6 @@ public: return versioned_value(new_version.to_sstring()); } - static versioned_value leaving(const std::unordered_set& tokens) { - return versioned_value(version_string({sstring(versioned_value::STATUS_LEAVING), - make_token_string(tokens)})); - } - static versioned_value left(const std::unordered_set& tokens, int64_t expire_time) { return versioned_value(version_string({sstring(versioned_value::STATUS_LEFT), make_token_string(tokens), diff --git a/service/storage_service.cc b/service/storage_service.cc index f35563023a..5a033af140 100644 --- a/service/storage_service.cc +++ b/service/storage_service.cc @@ -3564,43 +3564,6 @@ future<> storage_service::handle_state_normal(inet_address endpoint, gms::permit _normal_state_handled_on_boot.insert(endpoint); } -future<> storage_service::handle_state_leaving(inet_address endpoint, gms::permit_id pid) { - slogger.debug("endpoint={} handle_state_leaving: permit_id={}", endpoint, pid); - - auto tokens = get_tokens_for(endpoint); - - slogger.debug("Node {} state leaving, tokens {}", endpoint, tokens); - - // If the node is previously unknown or tokens do not match, update tokenmetadata to - // have this node as 'normal' (it must have been using this token before the - // leave). This way we'll get pending ranges right. - auto tmlock = co_await get_token_metadata_lock(); - auto tmptr = co_await get_mutable_token_metadata_ptr(); - if (!tmptr->is_normal_token_owner(endpoint)) { - // FIXME: this code should probably resolve token collisions too, like handle_state_normal - slogger.info("Node {} state jump to leaving", endpoint); - - tmptr->update_topology(endpoint, get_dc_rack_for(endpoint), locator::node::state::being_decommissioned); - co_await tmptr->update_normal_tokens(tokens, endpoint); - } else { - auto tokens_ = tmptr->get_tokens(endpoint); - std::set tmp(tokens.begin(), tokens.end()); - if (!std::includes(tokens_.begin(), tokens_.end(), tmp.begin(), tmp.end())) { - slogger.warn("Node {} 'leaving' token mismatch. Long network partition?", endpoint); - slogger.debug("tokens_={}, tokens={}", tokens_, tmp); - - co_await tmptr->update_normal_tokens(tokens, endpoint); - } - } - - // at this point the endpoint is certainly a member with this token, so let's proceed - // normally - tmptr->add_leaving_endpoint(endpoint); - - co_await update_topology_change_info(tmptr, ::format("handle_state_leaving", endpoint)); - co_await replicate_to_all_cores(std::move(tmptr)); -} - future<> storage_service::handle_state_left(inet_address endpoint, std::vector pieces, gms::permit_id pid) { if (_raft_topology_change_enabled) { @@ -3699,8 +3662,6 @@ future<> storage_service::on_change(inet_address endpoint, application_state sta co_await handle_state_normal(endpoint, pid); } else if (move_name == sstring(versioned_value::REMOVED_TOKEN)) { co_await handle_state_removed(endpoint, std::move(pieces), pid); - } else if (move_name == sstring(versioned_value::STATUS_LEAVING)) { - co_await handle_state_leaving(endpoint, pid); } else if (move_name == sstring(versioned_value::STATUS_LEFT)) { co_await handle_state_left(endpoint, std::move(pieces), pid); } else if (move_name == sstring(versioned_value::STATUS_MOVING)) { @@ -4138,7 +4099,6 @@ future<> storage_service::check_for_endpoint_collision(std::unordered_set t + std::chrono::seconds(60)) { throw std::runtime_error("Other bootstrapping/leaving/moving nodes detected, cannot bootstrap while consistent_rangemovement is true (check_for_endpoint_collision)"); diff --git a/service/storage_service.hh b/service/storage_service.hh index 432d334a73..fe5b189acf 100644 --- a/service/storage_service.hh +++ b/service/storage_service.hh @@ -446,8 +446,6 @@ public: * if bootstrapping. stays this way until all files are received. * STATUS_NORMAL,token * ready to serve reads and writes. - * STATUS_LEAVING,token - * get ready to leave the cluster as part of a decommission * STATUS_LEFT,token * set after decommission is completed. * @@ -523,13 +521,6 @@ private: */ future<> handle_state_normal(inet_address endpoint, gms::permit_id); - /** - * Handle node preparing to leave the ring - * - * @param endpoint node - */ - future<> handle_state_leaving(inet_address endpoint, gms::permit_id); - /** * Handle node leaving the ring. This will happen when a node is decommissioned *