mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-28 10:41:12 +00:00
Merge 'Register API endpoints next to corresponding services' from Pavel Emelyanov
The API endpoints are registered for particular services (with rare exceptions), and once the corresponding service is ready, its endpoints section can be registered too. Same but reversed is for shutdown, and it's automatic with deferred actions. refs: #2737 Closes scylladb/scylladb#19208 * github.com:scylladb/scylladb: main: Register task manager API next to task manager itself main: Register messaging API next to messaging service main: Register repair API next to repair service
This commit is contained in:
39
main.cc
39
main.cc
@@ -1030,6 +1030,17 @@ To start the scylla server proper, simply invoke as: scylla server (or just scyl
|
||||
task_manager.stop().get();
|
||||
});
|
||||
|
||||
api::set_server_task_manager(ctx, task_manager, cfg).get();
|
||||
auto stop_tm_api = defer_verbose_shutdown("task manager API", [&ctx] {
|
||||
api::unset_server_task_manager(ctx).get();
|
||||
});
|
||||
#ifndef SCYLLA_BUILD_MODE_RELEASE
|
||||
api::set_server_task_manager_test(ctx, task_manager).get();
|
||||
auto stop_tm_test_api = defer_verbose_shutdown("task manager API", [&ctx] {
|
||||
api::unset_server_task_manager_test(ctx).get();
|
||||
});
|
||||
#endif
|
||||
|
||||
// Note: changed from using a move here, because we want the config object intact.
|
||||
replica::database_config dbcfg;
|
||||
dbcfg.compaction_scheduling_group = make_sched_group("compaction", "comp", 1000);
|
||||
@@ -1368,6 +1379,11 @@ To start the scylla server proper, simply invoke as: scylla server (or just scyl
|
||||
// before start_listen is called.
|
||||
messaging.invoke_on_all(&netw::messaging_service::start).get();
|
||||
|
||||
api::set_server_messaging_service(ctx, messaging).get();
|
||||
auto stop_messaging_api = defer_verbose_shutdown("messaging service API", [&ctx] {
|
||||
api::unset_server_messaging_service(ctx).get();
|
||||
});
|
||||
|
||||
supervisor::notify("starting gossiper");
|
||||
auto cluster_name = cfg->cluster_name();
|
||||
if (cluster_name.empty()) {
|
||||
@@ -1688,6 +1704,10 @@ To start the scylla server proper, simply invoke as: scylla server (or just scyl
|
||||
repair.stop().get();
|
||||
});
|
||||
repair.invoke_on_all(&repair_service::start).get();
|
||||
api::set_server_repair(ctx, repair).get();
|
||||
auto stop_repair_api = defer_verbose_shutdown("repair API", [&ctx] {
|
||||
api::unset_server_repair(ctx).get();
|
||||
});
|
||||
|
||||
supervisor::notify("starting CDC Generation Management service");
|
||||
/* This service uses the system distributed keyspace.
|
||||
@@ -1723,25 +1743,6 @@ To start the scylla server proper, simply invoke as: scylla server (or just scyl
|
||||
|
||||
supervisor::notify("starting storage service", true);
|
||||
|
||||
api::set_server_messaging_service(ctx, messaging).get();
|
||||
auto stop_messaging_api = defer_verbose_shutdown("messaging service API", [&ctx] {
|
||||
api::unset_server_messaging_service(ctx).get();
|
||||
});
|
||||
api::set_server_repair(ctx, repair).get();
|
||||
auto stop_repair_api = defer_verbose_shutdown("repair API", [&ctx] {
|
||||
api::unset_server_repair(ctx).get();
|
||||
});
|
||||
|
||||
api::set_server_task_manager(ctx, task_manager, cfg).get();
|
||||
auto stop_tm_api = defer_verbose_shutdown("task manager API", [&ctx] {
|
||||
api::unset_server_task_manager(ctx).get();
|
||||
});
|
||||
#ifndef SCYLLA_BUILD_MODE_RELEASE
|
||||
api::set_server_task_manager_test(ctx, task_manager).get();
|
||||
auto stop_tm_test_api = defer_verbose_shutdown("task manager API", [&ctx] {
|
||||
api::unset_server_task_manager_test(ctx).get();
|
||||
});
|
||||
#endif
|
||||
gossiper.local().register_(ss.local().shared_from_this());
|
||||
auto stop_listening = defer_verbose_shutdown("storage service notifications", [&gossiper, &ss] {
|
||||
gossiper.local().unregister_(ss.local().shared_from_this()).get();
|
||||
|
||||
Reference in New Issue
Block a user