mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-29 04:37:00 +00:00
Fixes a problem when raft-based topology is enabled, which loads topology from storage. It starts by clearing topology and then adding nodes one by one. Before this patch, this violates internal invariant of topology object which puts the local node as the first node. This would manifest by triggering an assert in topology::pop_node() which throws if popping the node at index 0 in order to keep the information about local node around. This is normally prevented by a check in topology::remove_node() which avoid calling pop_node() if removing the local node. But since there is no node which is marked as local, this check allows the first node to be popped. To fix the problem I lift the invariant that local node is always in _nodes. We still have information about local node in config. Instead of keeping it in _nodes, we recognize it as part of indexing. We also allow removing the local node like a regular node. The path which reloads topology works correctly after this, the local node will be recognized when (if) it is added to the topology. Fixes #13495 Closes #13498 * github.com:scylladb/scylladb: locator: topology: Fix move assignment locator: topology: Add printer tests: topology: Test that topology clearing preserves information about local node locator: topology: Recognize local node as part of indexing it locator: topology: Fix get_location(ep) for local node locator: topology: Fix typo locator: topology: Preserve config when cloning