mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-23 18:10:39 +00:00
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.
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<dht::token>& 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());
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user