From ca316f32f0e79048dbfdee2abbff752c46d2b175 Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Fri, 17 Sep 2021 14:54:34 +0300 Subject: [PATCH] messaging, main, gossiper: Move listening start into main Before preparing the cluster join process the messaging should be put into listening state. Right now it's done "on-demand" by the call to the do_shadow_round(), also there's a safety call in the start_gossiping(). Tests, however, should not start listening, so the do_bind boolean exists and is passed all the way around. Make the main() code explicitly call the messaging.start_listen() and leave tests without it. This change makes messaging start listening a bit earlier, but in between these old and new places there's nothing that needs messaging to stay deaf. As the do_bind becomes useless, the wait_for_gossip_to_settle() is also moved into main. Signed-off-by: Pavel Emelyanov --- gms/gossiper.cc | 4 ---- main.cc | 5 +++++ service/storage_service.cc | 5 ----- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/gms/gossiper.cc b/gms/gossiper.cc index 869b6304ce..7525071272 100644 --- a/gms/gossiper.cc +++ b/gms/gossiper.cc @@ -470,10 +470,6 @@ future<> gossiper::init_messaging(bind_messaging_port do_bind) { } _ms_registered = true; - if (do_bind) { - return _messaging.start_listen(); - } - return make_ready_future<>(); } diff --git a/main.cc b/main.cc index afb18d4f8d..cf3fa6478b 100644 --- a/main.cc +++ b/main.cc @@ -1172,10 +1172,15 @@ int main(int ac, char** av) { mm_notifier.local().unregister_listener(&ss.local()).get(); }); + with_scheduling_group(maintenance_scheduling_group, [&] { + return messaging.invoke_on_all(&netw::messaging_service::start_listen); + }).get(); + with_scheduling_group(maintenance_scheduling_group, [&] { return ss.local().init_server(); }).get(); + gossiper.local().wait_for_gossip_to_settle().get(); sst_format_selector.sync(); with_scheduling_group(maintenance_scheduling_group, [&] { diff --git a/service/storage_service.cc b/service/storage_service.cc index a32d07edfb..af79eb66e0 100644 --- a/service/storage_service.cc +++ b/service/storage_service.cc @@ -398,11 +398,6 @@ void storage_service::prepare_to_join( gossip_sharder().get(); // gossip Schema.emptyVersion forcing immediate check for schema updates (see MigrationManager#maybeScheduleSchemaPull) - - // Wait for gossip to settle so that the fetures will be enabled - if (do_bind) { - _gossiper.wait_for_gossip_to_settle().get(); - } } void storage_service::maybe_start_sys_dist_ks() {