storage_srvice, toplogy: Extract topology_state_machine::await_quiesced()
Will be used later in a place which doesn't have access to storage_service
but has to toplogy_state_machine.
It's not necessary to start group0 operation around polling because
the busy() state can be checked atomically and if it's false it means
the topology is no longer busy.
(cherry picked from commit 476c076a21)
This commit is contained in:
@@ -6200,14 +6200,8 @@ future<> storage_service::await_topology_quiesced() {
|
||||
co_return;
|
||||
}
|
||||
|
||||
group0_guard guard = co_await _group0->client().start_operation(&_group0_as, raft_timeout{});
|
||||
|
||||
while (_topology_state_machine._topology.is_busy()) {
|
||||
rtlogger.debug("await_topology_quiesced(): topology is busy");
|
||||
release_guard(std::move(guard));
|
||||
co_await _topology_state_machine.event.wait();
|
||||
guard = co_await _group0->client().start_operation(&_group0_as, raft_timeout{});
|
||||
}
|
||||
co_await _group0->group0_server().read_barrier(&_group0_as);
|
||||
co_await _topology_state_machine.await_not_busy();
|
||||
}
|
||||
|
||||
future<join_node_request_result> storage_service::join_node_request_handler(join_node_request_params params) {
|
||||
|
||||
@@ -235,6 +235,12 @@ topology::upgrade_state_type upgrade_state_from_string(const sstring& s) {
|
||||
on_internal_error(tsmlogger, format("cannot map name {} to upgrade_state", s));
|
||||
}
|
||||
|
||||
future<> topology_state_machine::await_not_busy() {
|
||||
while (_topology.is_busy()) {
|
||||
co_await event.wait();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
auto fmt::formatter<service::cleanup_status>::format(service::cleanup_status status,
|
||||
|
||||
@@ -226,6 +226,8 @@ struct topology_state_machine {
|
||||
using topology_type = topology;
|
||||
topology_type _topology;
|
||||
condition_variable event;
|
||||
|
||||
future<> await_not_busy();
|
||||
};
|
||||
|
||||
// Raft leader uses this command to drive bootstrap process on other nodes
|
||||
|
||||
Reference in New Issue
Block a user