From ffdafe40246b64c308ca439e963ee7d39921256e Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Tue, 26 Dec 2023 11:47:37 +0300 Subject: [PATCH] keyspace_metadata: Add default value for new_keyspace's durable_writes Almost all callers call new_keyspace with durable writes ON, so it's worth having default value for it Signed-off-by: Pavel Emelyanov --- alternator/executor.cc | 2 +- auth/service.cc | 3 +-- data_dictionary/keyspace_metadata.hh | 2 +- db/system_distributed_keyspace.cc | 6 ++---- table_helper.cc | 2 +- 5 files changed, 6 insertions(+), 9 deletions(-) diff --git a/alternator/executor.cc b/alternator/executor.cc index cf34641e46..47c75e0229 100644 --- a/alternator/executor.cc +++ b/alternator/executor.cc @@ -4534,7 +4534,7 @@ static lw_shared_ptr create_keyspace_metadata(std::string_vie initial_tablets = std::stol(tags_map.at(INITIAL_TABLETS_TAG_KEY)); } - return keyspace_metadata::new_keyspace(keyspace_name, "org.apache.cassandra.locator.NetworkTopologyStrategy", std::move(opts), initial_tablets, true); + return keyspace_metadata::new_keyspace(keyspace_name, "org.apache.cassandra.locator.NetworkTopologyStrategy", std::move(opts), initial_tablets); } future<> executor::start() { diff --git a/auth/service.cc b/auth/service.cc index 46c4713484..64bcf272c0 100644 --- a/auth/service.cc +++ b/auth/service.cc @@ -180,8 +180,7 @@ future<> service::create_keyspace_if_missing(::service::migration_manager& mm) c meta::AUTH_KS, "org.apache.cassandra.locator.SimpleStrategy", opts, - std::nullopt, - true); + std::nullopt); try { co_return co_await mm.announce(::service::prepare_new_keyspace_announcement(db.real_database(), ksm, ts), diff --git a/data_dictionary/keyspace_metadata.hh b/data_dictionary/keyspace_metadata.hh index 75493f55cb..6ea9ecc397 100644 --- a/data_dictionary/keyspace_metadata.hh +++ b/data_dictionary/keyspace_metadata.hh @@ -45,7 +45,7 @@ public: std::string_view strategy_name, locator::replication_strategy_config_options options, std::optional initial_tablets, - bool durables_writes, + bool durables_writes = true, std::vector cf_defs = std::vector{}, storage_options storage_opts = {}); static lw_shared_ptr diff --git a/db/system_distributed_keyspace.cc b/db/system_distributed_keyspace.cc index 28c8162c8f..118d56686b 100644 --- a/db/system_distributed_keyspace.cc +++ b/db/system_distributed_keyspace.cc @@ -265,8 +265,7 @@ future<> system_distributed_keyspace::start() { NAME, "org.apache.cassandra.locator.SimpleStrategy", {{"replication_factor", "3"}}, - std::nullopt, - true /* durable_writes */); + std::nullopt); if (!db.has_keyspace(NAME)) { mutations = service::prepare_new_keyspace_announcement(db.real_database(), sd_ksm, ts); description += format(" create {} keyspace;", NAME); @@ -278,8 +277,7 @@ future<> system_distributed_keyspace::start() { NAME_EVERYWHERE, "org.apache.cassandra.locator.EverywhereStrategy", {}, - std::nullopt, - true /* durable_writes */); + std::nullopt); if (!db.has_keyspace(NAME_EVERYWHERE)) { auto sde_mutations = service::prepare_new_keyspace_announcement(db.real_database(), sde_ksm, ts); std::move(sde_mutations.begin(), sde_mutations.end(), std::back_inserter(mutations)); diff --git a/table_helper.cc b/table_helper.cc index a69a34e77a..739f8a9f6c 100644 --- a/table_helper.cc +++ b/table_helper.cc @@ -145,7 +145,7 @@ future<> table_helper::setup_keyspace(cql3::query_processor& qp, service::migrat std::map opts; opts["replication_factor"] = replication_factor; - auto ksm = keyspace_metadata::new_keyspace(keyspace_name, "org.apache.cassandra.locator.SimpleStrategy", std::move(opts), std::nullopt, true); + auto ksm = keyspace_metadata::new_keyspace(keyspace_name, "org.apache.cassandra.locator.SimpleStrategy", std::move(opts), std::nullopt); while (!db.has_keyspace(keyspace_name)) { auto group0_guard = co_await mm.start_group0_operation();