diff --git a/service/strong_consistency/groups_manager.cc b/service/strong_consistency/groups_manager.cc index da0ad265c1..bc94a61d01 100644 --- a/service/strong_consistency/groups_manager.cc +++ b/service/strong_consistency/groups_manager.cc @@ -385,7 +385,22 @@ void groups_manager::update(token_metadata_ptr new_tm) { co_await start_raft_group(tablet, id, std::move(new_tm)); state.server = &_raft_gr.get_server(id); state.leader_info_updater = leader_info_updater(state, tablet, id); + + // We want to make sure the server is ready to serve requests before + // we report it as started in wait_for_groups_to_start(). + abort_on_expiry aoe(lowres_clock::now() + std::chrono::seconds(60)); + while (true) { + auto srv = raft_server(state, state.gate->hold()); + auto res = srv.begin_mutate(aoe.abort_source()); + if (auto w = get_if(&res)) { + co_await std::move(w->future); + } else { + break; + } + } + _starting_groups.erase(_starting_groups.iterator_to(state)); + logger.info("update(): raft server for tablet {} and group id {} is started", tablet, id); }); });