db: allow configuring a column family to be memory-only
Useful for tests.
This commit is contained in:
@@ -527,6 +527,8 @@ column_family::config
|
||||
keyspace::make_column_family_config(const schema& s) const {
|
||||
column_family::config cfg;
|
||||
cfg.datadir = column_family_directory(s.cf_name(), s.id());
|
||||
cfg.enable_disk_reads = _config.enable_disk_reads;
|
||||
cfg.enable_disk_writes = _config.enable_disk_writes;
|
||||
return cfg;
|
||||
}
|
||||
|
||||
|
||||
@@ -79,6 +79,8 @@ class column_family {
|
||||
public:
|
||||
struct config {
|
||||
sstring datadir;
|
||||
bool enable_disk_writes = true;
|
||||
bool enable_disk_reads = true;
|
||||
};
|
||||
private:
|
||||
schema_ptr _schema;
|
||||
@@ -150,6 +152,8 @@ class keyspace {
|
||||
public:
|
||||
struct config {
|
||||
sstring datadir;
|
||||
bool enable_disk_reads = true;
|
||||
bool enable_disk_writes = true;
|
||||
};
|
||||
private:
|
||||
std::unique_ptr<locator::abstract_replication_strategy> _replication_strategy;
|
||||
|
||||
@@ -209,6 +209,8 @@ SEASTAR_TEST_CASE(test_multiple_memtables_one_partition) {
|
||||
{{"p1", utf8_type}}, {{"c1", int32_type}}, {{"r1", int32_type}}, {}, utf8_type));
|
||||
|
||||
column_family::config cfg;
|
||||
cfg.enable_disk_reads = false;
|
||||
cfg.enable_disk_writes = false;
|
||||
column_family cf(s, cfg);
|
||||
|
||||
const column_definition& r1_col = *s->get_column_definition("r1");
|
||||
@@ -246,6 +248,8 @@ SEASTAR_TEST_CASE(test_multiple_memtables_multiple_partitions) {
|
||||
{{"p1", int32_type}}, {{"c1", int32_type}}, {{"r1", int32_type}}, {}, utf8_type));
|
||||
|
||||
column_family::config cfg;
|
||||
cfg.enable_disk_reads = false;
|
||||
cfg.enable_disk_writes = false;
|
||||
column_family cf(s, cfg);
|
||||
std::map<int32_t, std::map<int32_t, int32_t>> shadow, result;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user