mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-21 00:50:35 +00:00
Alternator's "/localnodes" HTTP requests is supposed to return the list of nodes in the local DC to which the user can send requests. Before commitbac7c33313we used the gossiper is_alive() method to determine if a node should be returned. That commit changed the check to is_normal() - because a node can be alive but in non-normal (e.g., joining) state and not ready for requests. However, it turns out that checking is_normal() is not enough, because if node is stopped abruptly, other nodes will still consider it "normal", but down (this is so-called "DN" state). So we need to check **both** is_alive() and is_normal(). This patch also adds a test reproducing this case, where a node is shut down abruptly. Before this patch, the test failed ("/localnodes" continued to return the dead node), and after it it passes. Fixes #21538 Signed-off-by: Nadav Har'El <nyh@scylladb.com> Closes scylladb/scylladb#21540 (cherry picked from commit7607f5e33e) Closes scylladb/scylladb#21633