diff --git a/locator/snitch_base.cc b/locator/snitch_base.cc index 2f78abfe7a..7c8eb90f31 100644 --- a/locator/snitch_base.cc +++ b/locator/snitch_base.cc @@ -9,7 +9,6 @@ */ #include "locator/snitch_base.hh" -#include "gms/gossiper.hh" #include "gms/application_state.hh" namespace locator { @@ -21,8 +20,8 @@ std::list> snitch_base:: }; } -snitch_ptr::snitch_ptr(const snitch_config cfg, sharded& g) - : _gossiper(g) { +snitch_ptr::snitch_ptr(const snitch_config cfg) +{ i_endpoint_snitch::ptr_type s; try { s = create_object(cfg.name, cfg); diff --git a/locator/snitch_base.hh b/locator/snitch_base.hh index 22c90f7df3..f7bf2bad14 100644 --- a/locator/snitch_base.hh +++ b/locator/snitch_base.hh @@ -206,17 +206,10 @@ struct snitch_ptr : public peering_sharded_service { return _ptr ? true : false; } - snitch_ptr(const snitch_config cfg, sharded&); - - gms::gossiper& get_local_gossiper() noexcept { return _gossiper.local(); } - const gms::gossiper& get_local_gossiper() const noexcept { return _gossiper.local(); } - - sharded& get_gossiper() noexcept { return _gossiper; } - const sharded& get_gossiper() const noexcept { return _gossiper; } + snitch_ptr(const snitch_config cfg); private: ptr_type _ptr; - sharded& _gossiper; }; /** @@ -246,7 +239,7 @@ inline future<> i_endpoint_snitch::reset_snitch(snitch_config cfg) { // (1) create a new snitch distributed tmp_snitch; try { - tmp_snitch.start(cfg, std::ref(get_local_snitch_ptr().get_gossiper())).get(); + tmp_snitch.start(cfg).get(); // (2) start the local instances of the new snitch tmp_snitch.invoke_on_all([] (snitch_ptr& local_inst) { diff --git a/main.cc b/main.cc index b7e746c081..74c792d863 100644 --- a/main.cc +++ b/main.cc @@ -895,7 +895,7 @@ To start the scylla server proper, simply invoke as: scylla server (or just scyl snitch_cfg.broadcast_rpc_address_specified_by_user = !cfg->broadcast_rpc_address().empty(); snitch_cfg.listen_address = utils::resolve(cfg->listen_address, family).get0(); sharded& snitch = i_endpoint_snitch::snitch_instance(); - snitch.start(snitch_cfg, std::ref(gossiper)).get(); + snitch.start(snitch_cfg).get(); auto stop_snitch = defer_verbose_shutdown("snitch", [&snitch] { snitch.stop().get(); }); diff --git a/test/boost/gossiping_property_file_snitch_test.cc b/test/boost/gossiping_property_file_snitch_test.cc index 7668c3f61c..0063e81e20 100644 --- a/test/boost/gossiping_property_file_snitch_test.cc +++ b/test/boost/gossiping_property_file_snitch_test.cc @@ -10,7 +10,6 @@ #include #include "locator/gossiping_property_file_snitch.hh" #include "utils/fb_utilities.hh" -#include "gms/gossiper.hh" #include #include #include @@ -21,10 +20,9 @@ namespace fs = std::filesystem; static fs::path test_files_subdir("test/resource/snitch_property_files"); -static sharded gossiper; static future<> create_snitch(locator::snitch_config cfg) { - return locator::i_endpoint_snitch::snitch_instance().start(cfg, std::ref(gossiper)).then([] { + return locator::i_endpoint_snitch::snitch_instance().start(cfg).then([] { return locator::i_endpoint_snitch::snitch_instance().invoke_on_all(&locator::snitch_ptr::start); }); } diff --git a/test/boost/network_topology_strategy_test.cc b/test/boost/network_topology_strategy_test.cc index 6c5aa392dd..0f1e619b6a 100644 --- a/test/boost/network_topology_strategy_test.cc +++ b/test/boost/network_topology_strategy_test.cc @@ -193,9 +193,8 @@ void simple_test() { // Create the RackInferringSnitch snitch_config cfg; cfg.name = "RackInferringSnitch"; - sharded g; sharded& snitch = i_endpoint_snitch::snitch_instance(); - snitch.start(cfg, std::ref(g)).get(); + snitch.start(cfg).get(); auto stop_snitch = defer([&snitch] { snitch.stop().get(); }); snitch.invoke_on_all(&snitch_ptr::start).get(); @@ -278,9 +277,8 @@ void heavy_origin_test() { // Create the RackInferringSnitch snitch_config cfg; cfg.name = "RackInferringSnitch"; - sharded g; sharded& snitch = i_endpoint_snitch::snitch_instance(); - snitch.start(cfg, std::ref(g)).get(); + snitch.start(cfg).get(); auto stop_snitch = defer([&snitch] { snitch.stop().get(); }); snitch.invoke_on_all(&snitch_ptr::start).get(); diff --git a/test/boost/snitch_reset_test.cc b/test/boost/snitch_reset_test.cc index 9d2efa4e07..72201bf228 100644 --- a/test/boost/snitch_reset_test.cc +++ b/test/boost/snitch_reset_test.cc @@ -10,7 +10,6 @@ #include #include "locator/gossiping_property_file_snitch.hh" #include "utils/fb_utilities.hh" -#include "gms/gossiper.hh" #include #include #include @@ -40,7 +39,6 @@ future<> one_test(const std::string& property_fname1, auto cpu0_dc_new = make_lw_shared(); auto cpu0_rack_new = make_lw_shared(); auto my_address = utils::fb_utilities::get_broadcast_address(); - sharded g; sharded& snitch = i_endpoint_snitch::snitch_instance(); try { @@ -54,7 +52,7 @@ future<> one_test(const std::string& property_fname1, snitch_config cfg; cfg.name = "org.apache.cassandra.locator.GossipingPropertyFileSnitch"; cfg.properties_file_name = fname1.string(); - snitch.start(cfg, std::ref(g)).get(); + snitch.start(cfg).get(); snitch.invoke_on_all(&snitch_ptr::start).get(); } catch (std::exception& e) { printf("%s\n", e.what()); diff --git a/test/lib/cql_test_env.cc b/test/lib/cql_test_env.cc index a2529174f2..8b184efe3c 100644 --- a/test/lib/cql_test_env.cc +++ b/test/lib/cql_test_env.cc @@ -605,7 +605,7 @@ public: gossiper.invoke_on_all(&gms::gossiper::start).get(); sharded& snitch = locator::i_endpoint_snitch::snitch_instance(); - snitch.start(locator::snitch_config{}, std::ref(gossiper)).get(); + snitch.start(locator::snitch_config{}).get(); auto stop_snitch = defer([&snitch] { snitch.stop().get(); }); snitch.invoke_on_all(&locator::snitch_ptr::start).get(); diff --git a/test/manual/ec2_snitch_test.cc b/test/manual/ec2_snitch_test.cc index e4baa11040..b911e056a5 100644 --- a/test/manual/ec2_snitch_test.cc +++ b/test/manual/ec2_snitch_test.cc @@ -9,7 +9,6 @@ #include #include "locator/ec2_snitch.hh" -#include "gms/gossiper.hh" #include "utils/fb_utilities.hh" #include #include @@ -38,9 +37,8 @@ future<> one_test(const std::string& property_fname, bool exp_result) { snitch_config cfg; cfg.name = "Ec2Snitch"; cfg.properties_file_name = fname.string(); - sharded g; - auto start = [cfg, &g] { - return i_endpoint_snitch::snitch_instance().start(cfg, std::ref(g)).then([] { + auto start = [cfg] { + return i_endpoint_snitch::snitch_instance().start(cfg).then([] { return i_endpoint_snitch::snitch_instance().invoke_on_all(&snitch_ptr::start); }); }; diff --git a/test/manual/gce_snitch_test.cc b/test/manual/gce_snitch_test.cc index c9f25dfd9b..ed975d05bb 100644 --- a/test/manual/gce_snitch_test.cc +++ b/test/manual/gce_snitch_test.cc @@ -26,7 +26,6 @@ #include #include #include -#include "gms/gossiper.hh" namespace fs = std::filesystem; @@ -85,9 +84,8 @@ future<> one_test(const std::string& property_fname, bool exp_result) { cfg.name = "GoogleCloudSnitch"; cfg.properties_file_name = fname.string(); cfg.gce_meta_server_url = meta_url; - sharded g; sharded& snitch = i_endpoint_snitch::snitch_instance(); - snitch.start(cfg, std::ref(g)).get(); + snitch.start(cfg).get(); snitch.invoke_on_all(&snitch_ptr::start).get(); if (!exp_result) { BOOST_ERROR("Failed to catch an error in a malformed configuration file");