mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-26 03:20:37 +00:00
tests: make test cql environment use volatile system keyspace
Prevents hangs due to the database not being able to persist a memtable. Tested-by: Asias He <asias@cloudius-systems.com>
This commit is contained in:
@@ -666,7 +666,7 @@ database::database(const db::config& cfg)
|
||||
, _version(empty_version)
|
||||
{
|
||||
bool durable = cfg.data_file_directories().size() > 0;
|
||||
db::system_keyspace::make(*this, durable);
|
||||
db::system_keyspace::make(*this, durable, _cfg->volatile_system_keyspace_for_testing());
|
||||
// Start compaction manager with two tasks for handling compaction jobs.
|
||||
_compaction_manager.start(2);
|
||||
setup_collectd();
|
||||
|
||||
@@ -71,7 +71,7 @@ class commitlog;
|
||||
class config;
|
||||
|
||||
namespace system_keyspace {
|
||||
void make(database& db, bool durable);
|
||||
void make(database& db, bool durable, bool volatile_testing_only);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -385,7 +385,7 @@ private:
|
||||
// not be using this directly. Go for the public create_keyspace instead.
|
||||
void add_keyspace(sstring name, keyspace k);
|
||||
void create_in_memory_keyspace(const lw_shared_ptr<keyspace_metadata>& ksm);
|
||||
friend void db::system_keyspace::make(database& db, bool durable);
|
||||
friend void db::system_keyspace::make(database& db, bool durable, bool volatile_testing_only);
|
||||
void setup_collectd();
|
||||
public:
|
||||
static utils::UUID empty_version;
|
||||
|
||||
@@ -690,6 +690,7 @@ public:
|
||||
val(enable_in_memory_data_store, bool, false, Used, "Enable in memory mode (system tables are always persisted)") \
|
||||
val(enable_cache, bool, true, Used, "Enable cache") \
|
||||
val(enable_commitlog, bool, true, Used, "Enable commitlog") \
|
||||
val(volatile_system_keyspace_for_testing, bool, false, Used, "Don't persist system keyspace - testing only!") \
|
||||
/* done! */
|
||||
|
||||
#define _make_value_member(name, type, deflt, status, desc, ...) \
|
||||
|
||||
@@ -813,16 +813,16 @@ std::vector<schema_ptr> all_tables() {
|
||||
return r;
|
||||
}
|
||||
|
||||
void make(database& db, bool durable) {
|
||||
void make(database& db, bool durable, bool volatile_testing_only) {
|
||||
auto ksm = make_lw_shared<keyspace_metadata>(NAME,
|
||||
"org.apache.cassandra.locator.LocalStrategy",
|
||||
std::map<sstring, sstring>{},
|
||||
durable
|
||||
);
|
||||
auto kscfg = db.make_keyspace_config(*ksm);
|
||||
kscfg.enable_disk_reads = true;
|
||||
kscfg.enable_disk_writes = true;
|
||||
kscfg.enable_commitlog = true;
|
||||
kscfg.enable_disk_reads = !volatile_testing_only;
|
||||
kscfg.enable_disk_writes = !volatile_testing_only;
|
||||
kscfg.enable_commitlog = !volatile_testing_only;
|
||||
kscfg.enable_cache = true;
|
||||
keyspace _ks{ksm, std::move(kscfg)};
|
||||
auto rs(locator::abstract_replication_strategy::create_replication_strategy(NAME, "LocalStrategy", service::get_local_storage_service().get_token_metadata(), ksm->strategy_options()));
|
||||
|
||||
@@ -83,7 +83,7 @@ future<> remove_endpoint(gms::inet_address ep);
|
||||
future<> update_hints_dropped(gms::inet_address ep, utils::UUID time_period, int value);
|
||||
|
||||
std::vector<schema_ptr> all_tables();
|
||||
void make(database& db, bool durable);
|
||||
void make(database& db, bool durable, bool volatile_testing_only = false);
|
||||
|
||||
future<foreign_ptr<lw_shared_ptr<reconcilable_result>>>
|
||||
query_mutations(service::storage_proxy& proxy, const sstring& cf_name);
|
||||
|
||||
@@ -216,6 +216,7 @@ future<::shared_ptr<cql_test_env>> make_env_for_test() {
|
||||
return seastar::async([db] {
|
||||
auto cfg = make_lw_shared<db::config>();
|
||||
cfg->data_file_directories() = {};
|
||||
cfg->volatile_system_keyspace_for_testing() = true;
|
||||
db->start(std::move(*cfg)).get();
|
||||
|
||||
distributed<service::storage_proxy>& proxy = service::get_storage_proxy();
|
||||
|
||||
Reference in New Issue
Block a user