migration_manager: Make prepare_keyspace_drop_announcement() return a future<>
It will be extended with listener notification firing, which is an async operation.
This commit is contained in:
@@ -535,7 +535,7 @@ future<executor::request_return_type> executor::delete_table(client_state& clien
|
||||
}
|
||||
|
||||
auto m = co_await mm.prepare_column_family_drop_announcement(keyspace_name, table_name, group0_guard.write_timestamp(), service::migration_manager::drop_views::yes);
|
||||
auto m2 = mm.prepare_keyspace_drop_announcement(keyspace_name, group0_guard.write_timestamp());
|
||||
auto m2 = co_await mm.prepare_keyspace_drop_announcement(keyspace_name, group0_guard.write_timestamp());
|
||||
|
||||
std::move(m2.begin(), m2.end(), std::back_inserter(m));
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ drop_keyspace_statement::prepare_schema_mutations(query_processor& qp, api::time
|
||||
::shared_ptr<cql_transport::event::schema_change> ret;
|
||||
|
||||
try {
|
||||
m = qp.get_migration_manager().prepare_keyspace_drop_announcement(_keyspace, ts);
|
||||
m = co_await qp.get_migration_manager().prepare_keyspace_drop_announcement(_keyspace, ts);
|
||||
|
||||
using namespace cql_transport;
|
||||
ret = ::make_shared<event::schema_change>(
|
||||
|
||||
@@ -738,14 +738,15 @@ future<std::vector<mutation>> migration_manager::prepare_aggregate_drop_announce
|
||||
return include_keyspace(*keyspace.metadata(), std::move(mutations));
|
||||
}
|
||||
|
||||
std::vector<mutation> migration_manager::prepare_keyspace_drop_announcement(const sstring& ks_name, api::timestamp_type ts) {
|
||||
future<std::vector<mutation>> migration_manager::prepare_keyspace_drop_announcement(const sstring& ks_name, api::timestamp_type ts) {
|
||||
auto& db = _storage_proxy.get_db().local();
|
||||
if (!db.has_keyspace(ks_name)) {
|
||||
throw exceptions::configuration_exception(format("Cannot drop non existing keyspace '{}'.", ks_name));
|
||||
}
|
||||
auto& keyspace = db.find_keyspace(ks_name);
|
||||
mlogger.info("Drop Keyspace '{}'", ks_name);
|
||||
return db::schema_tables::make_drop_keyspace_mutations(db.features().cluster_schema_features(), keyspace.metadata(), ts);
|
||||
auto mutations = db::schema_tables::make_drop_keyspace_mutations(db.features().cluster_schema_features(), keyspace.metadata(), ts);
|
||||
return make_ready_future<std::vector<mutation>>(std::move(mutations));
|
||||
}
|
||||
|
||||
future<std::vector<mutation>> migration_manager::prepare_column_family_drop_announcement(const sstring& ks_name,
|
||||
|
||||
@@ -134,7 +134,7 @@ public:
|
||||
|
||||
future<std::vector<mutation>> prepare_update_type_announcement(user_type updated_type, api::timestamp_type);
|
||||
|
||||
std::vector<mutation> prepare_keyspace_drop_announcement(const sstring& ks_name, api::timestamp_type);
|
||||
future<std::vector<mutation>> prepare_keyspace_drop_announcement(const sstring& ks_name, api::timestamp_type);
|
||||
|
||||
class drop_views_tag;
|
||||
using drop_views = bool_class<drop_views_tag>;
|
||||
|
||||
@@ -477,7 +477,7 @@ SEASTAR_TEST_CASE(test_merging_creates_a_table_even_if_keyspace_was_recreated) {
|
||||
{
|
||||
auto group0_guard = mm.start_group0_operation().get();
|
||||
const auto ts = group0_guard.write_timestamp();
|
||||
auto muts = e.migration_manager().local().prepare_keyspace_drop_announcement("ks", ts);
|
||||
auto muts = e.migration_manager().local().prepare_keyspace_drop_announcement("ks", ts).get0();
|
||||
boost::copy(muts, std::back_inserter(all_muts));
|
||||
mm.announce(muts, std::move(group0_guard)).get();
|
||||
}
|
||||
|
||||
@@ -947,7 +947,7 @@ public:
|
||||
throw NotFoundException();
|
||||
}
|
||||
|
||||
co_return mm.prepare_keyspace_drop_announcement(keyspace, ts);
|
||||
co_return co_await mm.prepare_keyspace_drop_announcement(keyspace, ts);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user