gossiper: Remove features and sysks from gossiper

Now gossiper doesn't need those two as its dependencies, they can be
removed making code shorter and dependencies graph simpler.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
This commit is contained in:
Pavel Emelyanov
2023-04-25 12:44:47 +03:00
parent 5cbc8fe2f9
commit 9bb4ee160f
5 changed files with 5 additions and 18 deletions

View File

@@ -70,12 +70,10 @@ std::chrono::milliseconds gossiper::quarantine_delay() const noexcept {
return ring_delay * 2;
}
gossiper::gossiper(abort_source& as, feature_service& features, const locator::shared_token_metadata& stm, netw::messaging_service& ms, sharded<db::system_keyspace>& sys_ks, const db::config& cfg, gossip_config gcfg)
gossiper::gossiper(abort_source& as, const locator::shared_token_metadata& stm, netw::messaging_service& ms, const db::config& cfg, gossip_config gcfg)
: _abort_source(as)
, _feature_service(features)
, _shared_token_metadata(stm)
, _messaging(ms)
, _sys_ks(sys_ks)
, _failure_detector_timeout_ms(cfg.failure_detector_timeout_in_ms)
, _force_gossip_generation(cfg.force_gossip_generation)
, _gcfg(std::move(gcfg)) {

View File

@@ -42,7 +42,6 @@
namespace db {
class config;
class system_keyspace;
}
namespace gms {
@@ -56,8 +55,6 @@ class i_endpoint_state_change_subscriber;
class gossip_get_endpoint_states_request;
class gossip_get_endpoint_states_response;
class feature_service;
using advertise_myself = bool_class<class advertise_myself_tag>;
struct syn_msg_pending {
@@ -242,7 +239,7 @@ private:
// The value must be kept alive until completes and not change.
future<> replicate(inet_address, application_state key, const versioned_value& value);
public:
explicit gossiper(abort_source& as, feature_service& features, const locator::shared_token_metadata& stm, netw::messaging_service& ms, sharded<db::system_keyspace>& sys_ks, const db::config& cfg, gossip_config gcfg);
explicit gossiper(abort_source& as, const locator::shared_token_metadata& stm, netw::messaging_service& ms, const db::config& cfg, gossip_config gcfg);
/**
* Register for interesting state changes.
@@ -591,10 +588,8 @@ private:
class msg_proc_guard;
private:
abort_source& _abort_source;
feature_service& _feature_service;
const locator::shared_token_metadata& _shared_token_metadata;
netw::messaging_service& _messaging;
sharded<db::system_keyspace>& _sys_ks;
utils::updateable_value<uint32_t> _failure_detector_timeout_ms;
utils::updateable_value<int32_t> _force_gossip_generation;
gossip_config _gcfg;

View File

@@ -943,7 +943,7 @@ To start the scylla server proper, simply invoke as: scylla server (or just scyl
}
debug::the_gossiper = &gossiper;
gossiper.start(std::ref(stop_signal.as_sharded_abort_source()), std::ref(feature_service), std::ref(token_metadata), std::ref(messaging), std::ref(sys_ks), std::ref(*cfg), std::ref(gcfg)).get();
gossiper.start(std::ref(stop_signal.as_sharded_abort_source()), std::ref(token_metadata), std::ref(messaging), std::ref(*cfg), std::ref(gcfg)).get();
auto stop_gossiper = defer_verbose_shutdown("gossiper", [&gossiper] {
// call stop on each instance, but leave the sharded<> pointers alive
gossiper.invoke_on_all(&gms::gossiper::stop).get();

View File

@@ -641,7 +641,7 @@ public:
gcfg.cluster_name = "Test Cluster";
gcfg.seeds = std::move(seeds);
gcfg.skip_wait_for_gossip_to_settle = 0;
gossiper.start(std::ref(abort_sources), std::ref(feature_service), std::ref(token_metadata), std::ref(ms), std::ref(sys_ks), std::ref(*cfg), std::move(gcfg)).get();
gossiper.start(std::ref(abort_sources), std::ref(token_metadata), std::ref(ms), std::ref(*cfg), std::move(gcfg)).get();
auto stop_ms_fd_gossiper = defer([&gossiper] {
gossiper.stop().get();
});

View File

@@ -14,7 +14,6 @@
#include "db/system_distributed_keyspace.hh"
#include "message/messaging_service.hh"
#include "gms/feature_service.hh"
#include "gms/gossiper.hh"
#include "gms/application_state.hh"
#include "utils/fb_utilities.hh"
@@ -60,14 +59,9 @@ int main(int ac, char ** av) {
utils::fb_utilities::set_broadcast_rpc_address(listen);
auto cfg = std::make_unique<db::config>();
sharded<gms::feature_service> feature_service;
feature_service.start(gms::feature_config_from_db_config(*cfg)).get();
auto stop_feature_service = deferred_stop(feature_service);
sharded<abort_source> abort_sources;
sharded<locator::shared_token_metadata> token_metadata;
sharded<netw::messaging_service> messaging;
sharded<db::system_keyspace> sys_ks;
abort_sources.start().get();
auto stop_abort_source = defer([&] { abort_sources.stop().get(); });
@@ -83,7 +77,7 @@ int main(int ac, char ** av) {
gcfg.seeds.emplace(std::move(s));
}
sharded<gms::gossiper> gossiper;
gossiper.start(std::ref(abort_sources), std::ref(feature_service), std::ref(token_metadata), std::ref(messaging), std::ref(sys_ks), std::ref(*cfg), std::move(gcfg)).get();
gossiper.start(std::ref(abort_sources), std::ref(token_metadata), std::ref(messaging), std::ref(*cfg), std::move(gcfg)).get();
auto& server = messaging.local();
auto port = server.port();