From 1ac8edb22b58d986fde53ab97acb31f150d97fe8 Mon Sep 17 00:00:00 2001 From: Gleb Natapov Date: Mon, 23 Mar 2026 12:13:05 +0200 Subject: [PATCH] storage_service: drop is_first_node function It make no sense now since the first node to bootstrap is determined by discover_group0 algorithm. --- service/storage_service.cc | 26 +------------------------- service/storage_service.hh | 2 -- 2 files changed, 1 insertion(+), 27 deletions(-) diff --git a/service/storage_service.cc b/service/storage_service.cc index b217b3a368..c2abbc1c42 100644 --- a/service/storage_service.cc +++ b/service/storage_service.cc @@ -352,30 +352,6 @@ bool storage_service::is_replacing() { return !cfg.replace_address().empty(); } -bool storage_service::is_first_node() { - if (is_replacing()) { - return false; - } - auto seeds = _gossiper.get_seeds(); - if (seeds.empty()) { - return false; - } - // Node with the smallest IP address is chosen as the very first node - // in the cluster. The first node is the only node that does not - // bootstrap in the cluster. All other nodes will bootstrap. - std::vector sorted_seeds(seeds.begin(), seeds.end()); - std::sort(sorted_seeds.begin(), sorted_seeds.end()); - if (sorted_seeds.front() == get_broadcast_address()) { - slogger.info("I am the first node in the cluster. Skip bootstrap. Node={}", get_broadcast_address()); - return true; - } - return false; -} - -bool storage_service::should_bootstrap() { - return !_sys_ks.local().bootstrap_complete() && !is_first_node(); -} - /* Broadcasts the chosen tokens through gossip, * together with a CDC generation timestamp and STATUS=NORMAL. * @@ -1575,7 +1551,7 @@ future<> storage_service::join_topology(sharded& proxy, raft_replace_info = raft_group0::replace_info { .raft_id = raft::server_id{ri->host_id.uuid()}, }; - } else if (should_bootstrap()) { + } else if (!_sys_ks.local().bootstrap_complete()) { co_await check_for_endpoint_collision(initial_contact_nodes); } else { slogger.info("Performing gossip shadow round, initial_contact_nodes={}", initial_contact_nodes); diff --git a/service/storage_service.hh b/service/storage_service.hh index 599f6653a9..26c2a44ddb 100644 --- a/service/storage_service.hh +++ b/service/storage_service.hh @@ -492,9 +492,7 @@ public: future<> wait_for_group0_stop(); private: - bool should_bootstrap(); bool is_replacing(); - bool is_first_node(); future<> start_sys_dist_ks() const; future<> join_topology(sharded& proxy, std::unordered_set initial_contact_nodes,