From 41dd29f5a360203f36d386ea15e6ccb35fc30f1c Mon Sep 17 00:00:00 2001 From: Sergey Zolotukhin Date: Fri, 5 Sep 2025 09:21:04 +0200 Subject: [PATCH] gossiper: fix empty initial local node state This change removes the addition of an empty state to `_endpoint_state_map`. Instead, a new state is created locally and then published via replicate, avoiding the issue of an empty state existing in `_endpoint_state_map` before the preemption point. Since this resolves the issue tested in `test_gossiper_empty_self_id_on_shadow_round`, the `xfail` mark has been removed. Fixes: scylladb/scylladb#25831 (cherry picked from commit b34d543f30cb5e80529ed3994f5495157fbec1ae) --- gms/gossiper.cc | 6 ++++-- test/cluster/test_gossiper_empty_self_id_on_shadow_round.py | 1 - 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/gms/gossiper.cc b/gms/gossiper.cc index b759672e35..4be51241d8 100644 --- a/gms/gossiper.cc +++ b/gms/gossiper.cc @@ -2093,7 +2093,9 @@ future<> gossiper::start_gossiping(gms::generation_type generation_nbr, applicat generation_nbr = gms::generation_type(_gcfg.force_gossip_generation()); logger.warn("Use the generation number provided by user: generation = {}", generation_nbr); } - endpoint_state local_state = my_endpoint_state(); + + // Create a new local state. + endpoint_state local_state{get_broadcast_address()}; local_state.set_heart_beat_state_and_update_timestamp(heart_beat_state(generation_nbr)); for (auto& entry : preload_local_states) { local_state.add_application_state(entry.first, entry.second); @@ -2103,7 +2105,7 @@ future<> gossiper::start_gossiping(gms::generation_type generation_nbr, applicat co_await replicate(local_state, permit.id()); - logger.info("Gossip started with local state: {}", local_state); + logger.info("Gossip started with local state: {}", my_endpoint_state()); _enabled = true; _nr_run = 0; _scheduled_gossip_task.arm(INTERVAL); diff --git a/test/cluster/test_gossiper_empty_self_id_on_shadow_round.py b/test/cluster/test_gossiper_empty_self_id_on_shadow_round.py index 3faa459897..290112c0f8 100644 --- a/test/cluster/test_gossiper_empty_self_id_on_shadow_round.py +++ b/test/cluster/test_gossiper_empty_self_id_on_shadow_round.py @@ -17,7 +17,6 @@ from test.pylib.manager_client import ManagerClient @pytest.mark.asyncio @skip_mode('release', 'error injections are not supported in release mode') -@pytest.mark.xfail(reason="https://github.com/scylladb/scylladb/issues/25831") async def test_gossiper_empty_self_id_on_shadow_round(manager: ManagerClient): """ Test gossiper race condition on bootstrap that can lead to an empty self host ID sent in replies to other nodes.