From 1745a1551a35cd09da8ae322e163135ae29e9af9 Mon Sep 17 00:00:00 2001 From: Petr Gusev Date: Tue, 5 Dec 2023 14:02:49 +0400 Subject: [PATCH] storage_service: node_ops_cmd_handler: add coordinator_host_id We'll need it in the next commits to address to replacing and bootstrapping nodes by id. We assume this change will be shipped in 6.0 with upgrade from 5.4, where host_id already exists in client_info. We don't support upgrade between non-adjacent versions. --- service/storage_service.cc | 10 +++++++--- service/storage_service.hh | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/service/storage_service.cc b/service/storage_service.cc index 31c5228ef6..c612e83d0f 100644 --- a/service/storage_service.cc +++ b/service/storage_service.cc @@ -5462,7 +5462,7 @@ void storage_service::node_ops_insert(node_ops_id ops_uuid, on_node_ops_registered(ops_uuid); } -future storage_service::node_ops_cmd_handler(gms::inet_address coordinator, node_ops_cmd_request req) { +future storage_service::node_ops_cmd_handler(gms::inet_address coordinator, std::optional, node_ops_cmd_request req) { return seastar::async([this, coordinator, req = std::move(req)] () mutable { auto ops_uuid = req.ops_uuid; auto topo_guard = null_topology_guard; @@ -7172,8 +7172,12 @@ future storage_service::join_node_response_handler(jo void storage_service::init_messaging_service(bool raft_topology_change_enabled) { _messaging.local().register_node_ops_cmd([this] (const rpc::client_info& cinfo, node_ops_cmd_request req) { auto coordinator = cinfo.retrieve_auxiliary("baddr"); - return container().invoke_on(0, [coordinator, req = std::move(req)] (auto& ss) mutable { - return ss.node_ops_cmd_handler(coordinator, std::move(req)); + std::optional coordinator_host_id; + if (const auto* id = cinfo.retrieve_auxiliary_opt("host_id")) { + coordinator_host_id = *id; + } + return container().invoke_on(0, [coordinator, coordinator_host_id, req = std::move(req)] (auto& ss) mutable { + return ss.node_ops_cmd_handler(coordinator, coordinator_host_id, std::move(req)); }); }); if (raft_topology_change_enabled) { diff --git a/service/storage_service.hh b/service/storage_service.hh index c8ad5970c4..f12b21d0a9 100644 --- a/service/storage_service.hh +++ b/service/storage_service.hh @@ -656,7 +656,7 @@ public: * @param hostIdString token for the node */ future<> removenode(locator::host_id host_id, std::list ignore_nodes); - future node_ops_cmd_handler(gms::inet_address coordinator, node_ops_cmd_request req); + future node_ops_cmd_handler(gms::inet_address coordinator, std::optional coordinator_host_id, node_ops_cmd_request req); void node_ops_cmd_check(gms::inet_address coordinator, const node_ops_cmd_request& req); future<> node_ops_cmd_heartbeat_updater(node_ops_cmd cmd, node_ops_id uuid, std::list nodes, lw_shared_ptr heartbeat_updater_done); void on_node_ops_registered(node_ops_id);