mirror of
https://github.com/scylladb/scylladb.git
synced 2026-06-01 04:26:48 +00:00
We need to wait until the first node becomes normal in `join_node_request_handler` to ensure that joining nodes are not handled as the first node in the cluster. If we placed a join request before the first node becomes normal, the topology coordinator would incorrectly skip the join node handshake in `handle_node_transition` (`case node_state::none`). It would happen because the topology coordinator decides whether a node is the first in the cluster by checking if there are no normal nodes. Therefore, we must ensure at least one normal node when the topology coordinator handles a join request for a non-first node. We change the previous check because it can return true if there are no normal nodes. `topology::is_empty` would also return false if the first node was still new or in transition. Additionally, calling `join_node_request_handler` before the first node sets itself as normal is frequent during concurrent bootstrap, so we remove "unlikely" from the comment. Fixes: scylladb/scylladb#15807 Closes scylladb/scylladb#15775