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 b34d543f30)
This commit is contained in:
Sergey Zolotukhin
2025-09-05 09:21:04 +02:00
committed by GitHub Action
parent 13f43e2872
commit 41dd29f5a3
2 changed files with 4 additions and 3 deletions

View File

@@ -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);

View File

@@ -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.