From abb1dd608f81d19bf68ece9262babb71b602f362 Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Fri, 24 Jul 2020 15:55:28 +0300 Subject: [PATCH] migration_manager: Make push_schema_mutation private non-static method The local migration manager instance is already available at caller, so we can call a method on it. This is to facilitate next patching. Signed-off-by: Pavel Emelyanov --- service/migration_manager.cc | 11 ++++++----- service/migration_manager.hh | 4 ++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/service/migration_manager.cc b/service/migration_manager.cc index dd0751e468..4964d7a5b1 100644 --- a/service/migration_manager.cc +++ b/service/migration_manager.cc @@ -972,7 +972,7 @@ future<> migration_manager::announce(std::vector mutations, bool annou future<> migration_manager::push_schema_mutation(const gms::inet_address& endpoint, const std::vector& schema) { netw::messaging_service::msg_addr id{endpoint, 0}; - auto schema_features = get_local_migration_manager()._feat.cluster_schema_features(); + auto schema_features = _feat.cluster_schema_features(); auto adjusted_schema = db::schema_tables::adjust_schema_for_schema_features(schema, schema_features); auto fm = std::vector(adjusted_schema.begin(), adjusted_schema.end()); auto cm = std::vector(adjusted_schema.begin(), adjusted_schema.end()); @@ -981,16 +981,17 @@ future<> migration_manager::push_schema_mutation(const gms::inet_address& endpoi // Returns a future on the local application of the schema future<> migration_manager::announce(std::vector schema) { - auto f = db::schema_tables::merge_schema(get_storage_proxy(), get_local_migration_manager()._feat, schema); + migration_manager& mm = get_local_migration_manager(); + auto f = db::schema_tables::merge_schema(get_storage_proxy(), mm._feat, schema); - return do_with(std::move(schema), [live_members = gms::get_local_gossiper().get_live_members()](auto && schema) { - return parallel_for_each(live_members.begin(), live_members.end(), [&schema](auto& endpoint) { + return do_with(std::move(schema), [live_members = gms::get_local_gossiper().get_live_members(), &mm](auto && schema) { + return parallel_for_each(live_members.begin(), live_members.end(), [&schema, &mm](auto& endpoint) { // only push schema to nodes with known and equal versions if (endpoint != utils::fb_utilities::get_broadcast_address() && netw::get_local_messaging_service().knows_version(endpoint) && netw::get_local_messaging_service().get_raw_version(endpoint) == netw::messaging_service::current_version) { - return push_schema_mutation(endpoint, schema); + return mm.push_schema_mutation(endpoint, schema); } else { return make_ready_future<>(); } diff --git a/service/migration_manager.hh b/service/migration_manager.hh index 9f46ec9263..de076378bd 100644 --- a/service/migration_manager.hh +++ b/service/migration_manager.hh @@ -158,8 +158,6 @@ public: static future<> announce(std::vector mutations, bool announce_locally); - static future<> push_schema_mutation(const gms::inet_address& endpoint, const std::vector& schema); - // Returns a future on the local application of the schema static future<> announce(std::vector schema); @@ -180,6 +178,8 @@ private: const keyspace_metadata& keyspace, std::vector mutations, bool announce_locally); static future<> do_announce_new_type(user_type new_type, bool announce_locally); + + future<> push_schema_mutation(const gms::inet_address& endpoint, const std::vector& schema); }; extern distributed _the_migration_manager;