diff --git a/main.cc b/main.cc index 21353c0ce8..2da58da815 100644 --- a/main.cc +++ b/main.cc @@ -1446,7 +1446,7 @@ To start the scylla server proper, simply invoke as: scylla server (or just scyl supervisor::notify("initializing migration manager RPC verbs"); mm.invoke_on_all(&service::migration_manager::init_messaging_service).get(); supervisor::notify("initializing storage proxy RPC verbs"); - proxy.invoke_on_all(&service::storage_proxy::start_remote, std::ref(messaging), std::ref(gossiper), std::ref(mm)).get(); + proxy.invoke_on_all(&service::storage_proxy::start_remote, std::ref(messaging), std::ref(gossiper), std::ref(mm), std::ref(sys_ks)).get(); auto stop_proxy_handlers = defer_verbose_shutdown("storage proxy RPC verbs", [&proxy] { proxy.invoke_on_all(&service::storage_proxy::stop_remote).get(); }); diff --git a/service/storage_proxy.cc b/service/storage_proxy.cc index 02e6913de2..3ebf69b759 100644 --- a/service/storage_proxy.cc +++ b/service/storage_proxy.cc @@ -163,6 +163,7 @@ class storage_proxy::remote { netw::messaging_service& _ms; const gms::gossiper& _gossiper; migration_manager& _mm; + sharded& _sys_ks; netw::connection_drop_slot_t _connection_dropped; netw::connection_drop_registration_t _condrop_registration; @@ -170,8 +171,8 @@ class storage_proxy::remote { bool _stopped{false}; public: - remote(storage_proxy& sp, netw::messaging_service& ms, gms::gossiper& g, migration_manager& mm) - : _sp(sp), _ms(ms), _gossiper(g), _mm(mm) + remote(storage_proxy& sp, netw::messaging_service& ms, gms::gossiper& g, migration_manager& mm, sharded& sys_ks) + : _sp(sp), _ms(ms), _gossiper(g), _mm(mm), _sys_ks(sys_ks) , _connection_dropped(std::bind_front(&remote::connection_dropped, this)) , _condrop_registration(_ms.when_connection_drops(_connection_dropped)) { @@ -209,6 +210,10 @@ public: return _gossiper.is_alive(ep); } + db::system_keyspace& system_keyspace() { + return _sys_ks.local(); + } + // Note: none of the `send_*` functions use `remote` after yielding - by the first yield, // control is delegated to another service (messaging_service). Thus unfinished `send`s // do not make it unsafe to destroy the `remote` object. @@ -6233,8 +6238,8 @@ future<> storage_proxy::truncate_blocking(sstring keyspace, sstring cfname, std: return remote().send_truncate_blocking(std::move(keyspace), std::move(cfname), timeout_in_ms); } -void storage_proxy::start_remote(netw::messaging_service& ms, gms::gossiper& g, migration_manager& mm) { - _remote = std::make_unique(*this, ms, g, mm); +void storage_proxy::start_remote(netw::messaging_service& ms, gms::gossiper& g, migration_manager& mm, sharded& sys_ks) { + _remote = std::make_unique(*this, ms, g, mm, sys_ks); } future<> storage_proxy::stop_remote() { diff --git a/service/storage_proxy.hh b/service/storage_proxy.hh index 26810a46fa..d1ae69b8eb 100644 --- a/service/storage_proxy.hh +++ b/service/storage_proxy.hh @@ -487,7 +487,7 @@ public: } // Start/stop the remote part of `storage_proxy` that is required for performing distributed queries. - void start_remote(netw::messaging_service&, gms::gossiper&, migration_manager&); + void start_remote(netw::messaging_service&, gms::gossiper&, migration_manager&, sharded& sys_ks); future<> stop_remote(); private: