From 8a747fbc2a2c07f183b91ab7943bbd12bd349de9 Mon Sep 17 00:00:00 2001 From: Gleb Natapov Date: Wed, 12 Feb 2025 10:35:21 +0200 Subject: [PATCH] treewide: drop endpoint life cycle subscribers that do nothing Provide default implementation for them instead. Will be easier to rework them later. --- service/endpoint_lifecycle_subscriber.hh | 8 ++++---- service/qos/service_level_controller.cc | 6 ------ service/qos/service_level_controller.hh | 3 --- service/storage_proxy.cc | 4 ---- service/storage_proxy.hh | 2 -- service/topology_coordinator.cc | 2 -- 6 files changed, 4 insertions(+), 21 deletions(-) diff --git a/service/endpoint_lifecycle_subscriber.hh b/service/endpoint_lifecycle_subscriber.hh index 84a00db69b..59697d5d0a 100644 --- a/service/endpoint_lifecycle_subscriber.hh +++ b/service/endpoint_lifecycle_subscriber.hh @@ -35,7 +35,7 @@ public: * * @param endpoint the newly added endpoint. */ - virtual void on_join_cluster(const gms::inet_address& endpoint) = 0; + virtual void on_join_cluster(const gms::inet_address& endpoint) {} /** * Called when a new node leave the cluster (decommission or removeToken). @@ -43,21 +43,21 @@ public: * @param endpoint the IP of the endpoint that is leaving. * @param host_id the host ID of the endpoint that is leaving. */ - virtual void on_leave_cluster(const gms::inet_address& endpoint, const locator::host_id& host_id) = 0; + virtual void on_leave_cluster(const gms::inet_address& endpoint, const locator::host_id& host_id) {} /** * Called when a node is marked UP. * * @param endpoint the endpoint marked UP. */ - virtual void on_up(const gms::inet_address& endpoint) = 0; + virtual void on_up(const gms::inet_address& endpoint) {} /** * Called when a node is marked DOWN. * * @param endpoint the endpoint marked DOWN. */ - virtual void on_down(const gms::inet_address& endpoint) = 0; + virtual void on_down(const gms::inet_address& endpoint) {} }; class endpoint_lifecycle_notifier { diff --git a/service/qos/service_level_controller.cc b/service/qos/service_level_controller.cc index c76421f3c7..b965d98e62 100644 --- a/service/qos/service_level_controller.cc +++ b/service/qos/service_level_controller.cc @@ -891,8 +891,6 @@ future<> service_level_controller::do_remove_service_level(sstring name, bool re return make_ready_future(); } -void service_level_controller::on_join_cluster(const gms::inet_address& endpoint) { } - void service_level_controller::on_leave_cluster(const gms::inet_address& endpoint, const locator::host_id& hid) { if (this_shard_id() == global_controller && _token_metadata.get()->get_topology().is_me(hid)) { _global_controller_db->dist_data_update_aborter.request_abort(); @@ -900,10 +898,6 @@ void service_level_controller::on_leave_cluster(const gms::inet_address& endpoin } } -void service_level_controller::on_up(const gms::inet_address& endpoint) { } - -void service_level_controller::on_down(const gms::inet_address& endpoint) { } - void service_level_controller::register_subscriber(qos_configuration_change_subscriber* subscriber) { _subscribers.add(subscriber); } diff --git a/service/qos/service_level_controller.hh b/service/qos/service_level_controller.hh index 55674e1c76..e1ebcbf116 100644 --- a/service/qos/service_level_controller.hh +++ b/service/qos/service_level_controller.hh @@ -439,10 +439,7 @@ public: static sstring default_service_level_name; - virtual void on_join_cluster(const gms::inet_address& endpoint) override; virtual void on_leave_cluster(const gms::inet_address& endpoint, const locator::host_id& hid) override; - virtual void on_up(const gms::inet_address& endpoint) override; - virtual void on_down(const gms::inet_address& endpoint) override; }; future> diff --git a/service/storage_proxy.cc b/service/storage_proxy.cc index 114b07ecb0..160c149278 100644 --- a/service/storage_proxy.cc +++ b/service/storage_proxy.cc @@ -6899,16 +6899,12 @@ future<> storage_proxy::wait_for_hint_sync_point(const db::hints::sync_point spo co_return; } -void storage_proxy::on_join_cluster(const gms::inet_address& endpoint) {}; - void storage_proxy::on_leave_cluster(const gms::inet_address& endpoint, const locator::host_id& hid) { // Discarding these futures is safe. They're awaited by db::hints::manager::stop(). (void) _hints_manager.drain_for(hid, endpoint); (void) _hints_for_views_manager.drain_for(hid, endpoint); } -void storage_proxy::on_up(const gms::inet_address& endpoint) {}; - void storage_proxy::cancel_write_handlers(noncopyable_function filter_fun) { SCYLLA_ASSERT(thread::running_in_thread()); auto it = _cancellable_write_handlers_list->begin(); diff --git a/service/storage_proxy.hh b/service/storage_proxy.hh index a307a4ffb0..3396e1c41d 100644 --- a/service/storage_proxy.hh +++ b/service/storage_proxy.hh @@ -741,9 +741,7 @@ public: return _pending_writes_phaser.advance_and_await(); } - virtual void on_join_cluster(const gms::inet_address& endpoint) override; virtual void on_leave_cluster(const gms::inet_address& endpoint, const locator::host_id& hid) override; - virtual void on_up(const gms::inet_address& endpoint) override; virtual void on_down(const gms::inet_address& endpoint) override; friend class abstract_read_executor; diff --git a/service/topology_coordinator.cc b/service/topology_coordinator.cc index 0c4baddcce..8befb2483e 100644 --- a/service/topology_coordinator.cc +++ b/service/topology_coordinator.cc @@ -2859,8 +2859,6 @@ public: future<> run(); future<> stop(); - virtual void on_join_cluster(const gms::inet_address& endpoint) {} - virtual void on_leave_cluster(const gms::inet_address& endpoint, const locator::host_id& hid) {}; virtual void on_up(const gms::inet_address& endpoint) { _topo_sm.event.broadcast(); }; virtual void on_down(const gms::inet_address& endpoint) { _topo_sm.event.broadcast(); }; };