main: register storage proxy as lifecycle subscriber

In order to be able to act when node joins/leaves, storage proxy
is registered as an endpoint lifecycle subscriber.

Fixes #3826
Fixes #4028
This commit is contained in:
Piotr Sarna
2019-01-30 15:01:25 +01:00
parent 92df1d5a6b
commit c61d0ee8aa
2 changed files with 5 additions and 2 deletions

View File

@@ -767,7 +767,9 @@ int main(int ac, char** av) {
db::hints::manager::rebalance(cfg->view_hints_directory()).get();
proxy.invoke_on_all([] (service::storage_proxy& local_proxy) {
local_proxy.start_hints_manager(gms::get_local_gossiper().shared_from_this(), service::get_local_storage_service().shared_from_this());
auto& ss = service::get_local_storage_service();
ss.register_subscriber(&local_proxy);
local_proxy.start_hints_manager(gms::get_local_gossiper().shared_from_this(), ss.shared_from_this());
}).get();
supervisor::notify("starting messaging service");

View File

@@ -1383,7 +1383,8 @@ future<> storage_service::drain_on_shutdown() {
ss._sys_dist_ks.invoke_on_all(&db::system_distributed_keyspace::stop).get();
slogger.info("Drain on shutdown: system distributed keyspace stopped");
get_storage_proxy().invoke_on_all([] (storage_proxy& local_proxy) {
get_storage_proxy().invoke_on_all([&ss] (storage_proxy& local_proxy) mutable {
ss.unregister_subscriber(&local_proxy);
return local_proxy.stop_hints_manager();
}).get();
slogger.info("Drain on shutdown: hints manager is stopped");