From c9530eae4eb0aa34b182c15828b5ec064ccd2bf8 Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Fri, 28 Jul 2023 15:16:52 +0300 Subject: [PATCH] migration_manager: Add system_keyspace argument to get_schema_mapping() It will need one to pass to db::schema_tables code. The caller is paxos code with sys_ks local variable at hand Signed-off-by: Pavel Emelyanov --- service/migration_manager.cc | 2 +- service/migration_manager.hh | 2 +- service/paxos/paxos_state.cc | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/service/migration_manager.cc b/service/migration_manager.cc index 03ae07ec11..4bf9278d15 100644 --- a/service/migration_manager.cc +++ b/service/migration_manager.cc @@ -1183,7 +1183,7 @@ future<> migration_manager::sync_schema(const replica::database& db, const std:: }); } -future get_column_mapping(table_id table_id, table_schema_version v) { +future get_column_mapping(db::system_keyspace& sys_ks, table_id table_id, table_schema_version v) { schema_ptr s = local_schema_registry().get_or_null(v); if (s) { return make_ready_future(s->get_column_mapping()); diff --git a/service/migration_manager.hh b/service/migration_manager.hh index d0ef183c49..412f08d334 100644 --- a/service/migration_manager.hh +++ b/service/migration_manager.hh @@ -243,6 +243,6 @@ public: void set_concurrent_ddl_retries(size_t); }; -future get_column_mapping(table_id, table_schema_version v); +future get_column_mapping(db::system_keyspace& sys_ks, table_id, table_schema_version v); } diff --git a/service/paxos/paxos_state.cc b/service/paxos/paxos_state.cc index d8287202b2..7d302c9879 100644 --- a/service/paxos/paxos_state.cc +++ b/service/paxos/paxos_state.cc @@ -80,7 +80,7 @@ future paxos_state::prepare(storage_proxy& sp, db::system_keys prv, tr_state, timeout); }); }); - return when_all(std::move(f1), std::move(f2)).then([state = std::move(state), only_digest, schema] (auto t) mutable { + return when_all(std::move(f1), std::move(f2)).then([state = std::move(state), only_digest, schema, &sys_ks] (auto t) mutable { if (utils::get_local_injector().enter("paxos_error_after_save_promise")) { return make_exception_future(utils::injected_error("injected_error_after_save_promise")); } @@ -105,7 +105,7 @@ future paxos_state::prepare(storage_proxy& sp, db::system_keys auto ex = f2.get_exception(); logger.debug("Failed to get data or digest: {}. Ignored.", std::move(ex)); } - auto upgrade_if_needed = [schema = std::move(schema)] (std::optional p) { + auto upgrade_if_needed = [schema = std::move(schema), &sys_ks] (std::optional p) { if (!p || p->update.schema_version() == schema->version()) { return make_ready_future>(std::move(p)); } @@ -117,7 +117,7 @@ future paxos_state::prepare(storage_proxy& sp, db::system_keys // for that version and upgrade the mutation with it. logger.debug("Stored mutation references outdated schema version. " "Trying to upgrade the accepted proposal mutation to the most recent schema version."); - return service::get_column_mapping(p->update.column_family_id(), p->update.schema_version()).then([schema, p = std::move(p)] (const column_mapping& cm) { + return service::get_column_mapping(sys_ks, p->update.column_family_id(), p->update.schema_version()).then([schema, p = std::move(p)] (const column_mapping& cm) { return make_ready_future>(proposal(p->ballot, freeze(p->update.unfreeze_upgrading(schema, cm)))); }); };