storage_service: Remove the variable _manage_topology_change_kind_from_group0

This commit removes the variable _manage_topology_change_kind_from_group0
which was used earlier as a work around for correctly handling
topology_change_kind variable, it was brittle and had some bugs. Earlier commits
made some modifications to deal with handling topology_change_kind variable
post _manage_topology_change_kind_from_group0 removal
This commit is contained in:
Abhi
2025-01-29 15:03:41 +05:30
parent 623e01344b
commit d7884cf651
2 changed files with 1 additions and 13 deletions

View File

@@ -1834,9 +1834,6 @@ future<> storage_service::join_topology(sharded<db::system_distributed_keyspace>
}
}
// If we were the first node in the cluster, at this point `upgrade_state` will be
// initialized properly. Yield control to group 0
_manage_topology_change_kind_from_group0 = true;
set_topology_change_kind(upgrade_state_to_topology_op_kind(_topology_state_machine._topology.upgrade_state));
co_await update_topology_with_local_metadata(*raft_server);
@@ -1870,7 +1867,6 @@ future<> storage_service::join_topology(sharded<db::system_distributed_keyspace>
co_return;
}
_manage_topology_change_kind_from_group0 = true;
set_topology_change_kind(upgrade_state_to_topology_op_kind(_topology_state_machine._topology.upgrade_state));
// We bootstrap if we haven't successfully bootstrapped before, as long as we are not a seed.
@@ -2948,8 +2944,7 @@ future<> storage_service::join_cluster(sharded<db::system_distributed_keyspace>&
slogger.info("Raft recovery - starting in legacy topology operations mode");
set_topology_change_kind(topology_change_kind::legacy);
} else if (_group0->joined_group0()) {
// We are a part of group 0. The _topology_change_kind_enabled flag is maintained from there.
_manage_topology_change_kind_from_group0 = true;
// We are a part of group 0.
set_topology_change_kind(upgrade_state_to_topology_op_kind(_topology_state_machine._topology.upgrade_state));
if (_db.local().get_config().force_gossip_topology_changes() && raft_topology_change_enabled()) {
throw std::runtime_error("Cannot force gossip topology changes - the cluster is using raft-based topology");

View File

@@ -809,13 +809,6 @@ private:
// After the node successfully joins, the control over the variable is yielded
// to `topology_state_load`, so that it can control it during the upgrade from gossiper
// based topology to raft-based topology.
// FIXME: This boolean flag is mostly needed because, shortly after starting
// a new group 0, the state of `system.topology` is empty, and updating the
// `_topology_change_kind_enabled` variable from group 0 state would lead
// to wrong results. This could be fixed by writing an initial `system.topology`
// state before creating the group 0 (also making sure to set the correct
// group 0 state id so that the timestamps of further mutations are correct).
bool _manage_topology_change_kind_from_group0 = false;
topology_change_kind _topology_change_kind_enabled = topology_change_kind::unknown;
// Throws an exception if the node is either starting and didn't determine which