From 67102496c8622a273c0fe9df0530e71bbce07a3a Mon Sep 17 00:00:00 2001 From: Gleb Natapov Date: Mon, 16 Mar 2026 17:15:00 +0200 Subject: [PATCH] gossiper: drop last use of LEFT state and drop the state The decommission sets left gossiper state only to prevent shutdown notification be issued by the node during shutdown. Since the notification code now checks the state in raft topology this is no longer needed. --- gms/gossiper.cc | 4 ---- gms/gossiper.hh | 8 -------- gms/versioned_value.hh | 7 ------- service/storage_service.cc | 7 +------ 4 files changed, 1 insertion(+), 25 deletions(-) diff --git a/gms/gossiper.cc b/gms/gossiper.cc index 8941044723..6dab6b4edf 100644 --- a/gms/gossiper.cc +++ b/gms/gossiper.cc @@ -1714,10 +1714,6 @@ bool gossiper::is_normal(const locator::host_id& endpoint) const { return get_gossip_status(endpoint) == versioned_value::STATUS_NORMAL; } -bool gossiper::is_silent_shutdown_state(const endpoint_state& ep_state) const{ - return std::ranges::any_of(SILENT_SHUTDOWN_STATES, [state = get_gossip_status(ep_state)](const auto& deadstate) { return state == deadstate; }); -} - future<> gossiper::apply_new_states(endpoint_state local_state, const endpoint_state& remote_state, permit_id pid, bool shadow_round) { // don't SCYLLA_ASSERT here, since if the node restarts the version will go back to zero //int oldVersion = local_state.get_heart_beat_state().get_heart_beat_version(); diff --git a/gms/gossiper.hh b/gms/gossiper.hh index 66b68e6794..b92b0dfbb4 100644 --- a/gms/gossiper.hh +++ b/gms/gossiper.hh @@ -198,13 +198,6 @@ private: endpoint_locks_map _endpoint_locks; public: - static constexpr std::array DEAD_STATES{ - versioned_value::STATUS_LEFT, - }; - static constexpr std::array SILENT_SHUTDOWN_STATES{ - versioned_value::STATUS_LEFT, - versioned_value::STATUS_UNKNOWN, - }; static constexpr std::chrono::milliseconds INTERVAL{1000}; // Maximum difference between remote generation value and generation @@ -580,7 +573,6 @@ public: bool is_shutdown(const endpoint_state& eps) const; bool is_normal(const locator::host_id& endpoint) const; bool is_cql_ready(const locator::host_id& endpoint) const; - bool is_silent_shutdown_state(const endpoint_state& ep_state) const; void force_newer_generation(); public: std::string_view get_gossip_status(const endpoint_state& ep_state) const noexcept; diff --git a/gms/versioned_value.hh b/gms/versioned_value.hh index 6601a591f4..1df654ea54 100644 --- a/gms/versioned_value.hh +++ b/gms/versioned_value.hh @@ -46,7 +46,6 @@ public: // values for ApplicationState.STATUS static constexpr std::string_view STATUS_UNKNOWN{"UNKNOWN"}; static constexpr std::string_view STATUS_NORMAL{"NORMAL"}; - static constexpr std::string_view STATUS_LEFT{"LEFT"}; static constexpr std::string_view SHUTDOWN{"shutdown"}; @@ -105,12 +104,6 @@ public: return versioned_value(new_version.to_sstring()); } - 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), - std::to_string(expire_time)})); - } - static versioned_value host_id(const locator::host_id& host_id) { return versioned_value(host_id.to_sstring()); } diff --git a/service/storage_service.cc b/service/storage_service.cc index ef6eaac6c2..c96d3a3e54 100644 --- a/service/storage_service.cc +++ b/service/storage_service.cc @@ -2744,12 +2744,7 @@ future<> storage_service::raft_decommission() { rtlogger.info("decommission: waiting for completion (request ID: {})", request_id); auto error = co_await wait_for_topology_request_completion(request_id); - if (error.empty()) { - // Need to set it otherwise gossiper will try to send shutdown on exit - rtlogger.info("decommission: successfully removed from topology (request ID: {}), updating gossip status", request_id); - co_await _gossiper.add_local_application_state(std::pair(gms::application_state::STATUS, gms::versioned_value::left({}, _gossiper.now().time_since_epoch().count()))); - rtlogger.info("Decommission succeeded. Request ID: {}", request_id); - } else { + if (!error.empty()) { auto err = fmt::format("Decommission failed. See earlier errors ({}). Request ID: {}", error, request_id); rtlogger.error("{}", err); throw std::runtime_error(err);