api: initialize token metadata API after starting the gossiper

Token metadata API now depend on gossiper to do ip to host id mappings,
so initialized it after the gossiper is initialized and de-initialized
it before gossiper is stopped.

Fixes: scylladb/scylladb#22743

Closes scylladb/scylladb#22760
This commit is contained in:
Gleb Natapov
2025-02-09 15:15:30 +02:00
committed by Patryk Jędrzejczak
parent b5e306047f
commit d288d79d78

11
main.cc
View File

@@ -1082,12 +1082,6 @@ To start the scylla server proper, simply invoke as: scylla server (or just scyl
// token_metadata.stop().get();
//});
api::set_server_token_metadata(ctx, token_metadata, gossiper).get();
auto stop_tokens_api = defer_verbose_shutdown("token metadata API", [&ctx] {
api::unset_server_token_metadata(ctx).get();
});
supervisor::notify("starting effective_replication_map factory");
erm_factory.start().get();
auto stop_erm_factory = deferred_stop(erm_factory);
@@ -1619,6 +1613,11 @@ To start the scylla server proper, simply invoke as: scylla server (or just scyl
});
gossiper.invoke_on_all(&gms::gossiper::start).get();
api::set_server_token_metadata(ctx, token_metadata, gossiper).get();
auto stop_tokens_api = defer_verbose_shutdown("token metadata API", [&ctx] {
api::unset_server_token_metadata(ctx).get();
});
utils::get_local_injector().inject("stop_after_starting_gossiper",
[] { std::raise(SIGSTOP); });