From 282cc070bcb13907d37cbaa550b024c0b9d7fdb5 Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Fri, 20 May 2022 15:03:31 +0300 Subject: [PATCH] storage_service: Merge init-server and join-cluster Now they always follow one another both in main and cql-test-env. Also, despite the name, init-server does joins the cluster when it's just a normal node restarting, so join-cluster is called when the cluster is already joind. This merge make the function be named as what it really does. Signed-off-by: Pavel Emelyanov --- main.cc | 6 +----- service/storage_service.cc | 7 +------ service/storage_service.hh | 7 +------ test/lib/cql_test_env.cc | 3 +-- 4 files changed, 4 insertions(+), 19 deletions(-) diff --git a/main.cc b/main.cc index e65b8a98d5..7a81399a40 100644 --- a/main.cc +++ b/main.cc @@ -1273,11 +1273,7 @@ To start the scylla server proper, simply invoke as: scylla server (or just scyl }).get(); with_scheduling_group(maintenance_scheduling_group, [&] { - return ss.local().init_server(qp.local(), group0_client); - }).get(); - - with_scheduling_group(maintenance_scheduling_group, [&] { - return ss.local().join_cluster(); + return ss.local().join_cluster(qp.local(), group0_client); }).get(); sl_controller.invoke_on_all([&lifecycle_notifier] (qos::service_level_controller& controller) { diff --git a/service/storage_service.cc b/service/storage_service.cc index f64b9c5963..ee0c2e2652 100644 --- a/service/storage_service.cc +++ b/service/storage_service.cc @@ -1322,7 +1322,7 @@ future<> storage_service::uninit_messaging_service_part() { return container().invoke_on_all(&service::storage_service::uninit_messaging_service); } -future<> storage_service::init_server(cql3::query_processor& qp, raft_group0_client& client) { +future<> storage_service::join_cluster(cql3::query_processor& qp, raft_group0_client& client) { assert(this_shard_id() == 0); return seastar::async([this, &qp, &client] { @@ -1380,11 +1380,6 @@ future<> storage_service::init_server(cql3::query_processor& qp, raft_group0_cli slogger.info("peer={}, supported_features={}", x.first, x.second); } prepare_to_join(std::move(initial_contact_nodes), std::move(loaded_endpoints), std::move(loaded_peer_features)).get(); - }); -} - -future<> storage_service::join_cluster() { - return seastar::async([this] { join_token_ring(get_ring_delay()); }); } diff --git a/service/storage_service.hh b/service/storage_service.hh index ac9484e136..2afb03ca5d 100644 --- a/service/storage_service.hh +++ b/service/storage_service.hh @@ -362,9 +362,6 @@ public: * * The storage_service initialization is done in two parts. * - * you first call init_messaging_service_part and then - * you call init_server_without_the_messaging_service_part. - * * It is safe to start the API after init_messaging_service_part * completed * @@ -372,9 +369,7 @@ public: * * \see init_messaging_service_part */ - future<> init_server(cql3::query_processor& qp, raft_group0_client& client); - - future<> join_cluster(); + future<> join_cluster(cql3::query_processor& qp, raft_group0_client& client); future<> drain_on_shutdown(); diff --git a/test/lib/cql_test_env.cc b/test/lib/cql_test_env.cc index a739bb80a3..6617cd0d03 100644 --- a/test/lib/cql_test_env.cc +++ b/test/lib/cql_test_env.cc @@ -782,9 +782,8 @@ public: cdc.stop().get(); }); - ss.local().init_server(qp.local(), group0_client).get(); try { - ss.local().join_cluster().get(); + ss.local().join_cluster(qp.local(), group0_client).get(); } catch (std::exception& e) { // if any of the defers crashes too, we'll never see // the error