storage_service: get rid of handle_state_replacing

Since 2ec1f719de nodes no longer
publish HIBERNATE state so we don't need to support handling it.

Replace is now always done using node operations (using
repair or streaming).

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
This commit is contained in:
Benny Halevy
2022-12-19 08:17:49 +02:00
parent 7c7eb81a66
commit c9993f020d
3 changed files with 1 additions and 42 deletions

View File

@@ -174,10 +174,6 @@ public:
sstring(DELIMITER_STR) + host_id.to_sstring());
}
static versioned_value hibernate(bool value) {
return versioned_value(sstring(HIBERNATE) + sstring(DELIMITER_STR) + (value ? "true" : "false"));
}
static versioned_value shutdown(bool value) {
return versioned_value(sstring(SHUTDOWN) + sstring(DELIMITER_STR) + (value ? "true" : "false"));
}

View File

@@ -800,36 +800,6 @@ future<> storage_service::handle_state_replacing_update_pending_ranges(mutable_t
co_await update_pending_ranges(tmptr, format("handle_state_replacing {}", replacing_node));
}
future<> storage_service::handle_state_replacing(inet_address replacing_node) {
slogger.debug("endpoint={} handle_state_replacing", replacing_node);
auto host_id = _gossiper.get_host_id(replacing_node);
auto tmlock = co_await get_token_metadata_lock();
auto tmptr = co_await get_mutable_token_metadata_ptr();
auto existing_node_opt = tmptr->get_endpoint_for_host_id(host_id);
auto replace_addr = get_replace_address();
if (replacing_node == get_broadcast_address() && replace_addr && *replace_addr == get_broadcast_address()) {
existing_node_opt = replacing_node;
}
if (!existing_node_opt) {
slogger.warn("Can not find the existing node for the replacing node {}", replacing_node);
co_return;
}
auto existing_node = *existing_node_opt;
auto existing_tokens = get_tokens_for(existing_node);
auto replacing_tokens = get_tokens_for(replacing_node);
slogger.info("Node {} is replacing existing node {} with host_id={}, existing_tokens={}, replacing_tokens={}",
replacing_node, existing_node, host_id, existing_tokens, replacing_tokens);
tmptr->add_replacing_endpoint(existing_node, replacing_node);
if (_gossiper.is_alive(replacing_node)) {
slogger.info("handle_state_replacing: Replacing node {} is already alive, update pending ranges", replacing_node);
co_await handle_state_replacing_update_pending_ranges(tmptr, replacing_node);
} else {
slogger.info("handle_state_replacing: Replacing node {} is not alive yet, delay update pending ranges", replacing_node);
_replacing_nodes_pending_ranges_updater.insert(replacing_node);
}
co_await replicate_to_all_cores(std::move(tmptr));
}
future<> storage_service::handle_state_bootstrap(inet_address endpoint) {
slogger.debug("endpoint={} handle_state_bootstrap", endpoint);
// explicitly check for TOKENS, because a bootstrapping node might be bootstrapping in legacy mode; that is, not using vnodes and no token specified
@@ -1221,7 +1191,7 @@ future<> storage_service::on_change(inet_address endpoint, application_state sta
} else if (move_name == sstring(versioned_value::STATUS_MOVING)) {
handle_state_moving(endpoint, pieces);
} else if (move_name == sstring(versioned_value::HIBERNATE)) {
co_await handle_state_replacing(endpoint);
slogger.warn("endpoint={} went into HIBERNATE state, this is no longer supported. Use a new version to perform the replace operation.", endpoint);
} else {
co_return; // did nothing.
}

View File

@@ -541,13 +541,6 @@ private:
*/
future<> handle_state_removing(inet_address endpoint, std::vector<sstring> pieces);
/**
* Handle notification that a node is replacing another node.
*
* @param endpoint node
*/
future<> handle_state_replacing(inet_address endpoint);
future<>
handle_state_replacing_update_pending_ranges(mutable_token_metadata_ptr tmptr, inet_address replacing_node);