mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-30 05:07:05 +00:00
test: sstable_test_env: add make_table_for_tests
Wrap table_for_tests ctor to pass the env sstables_manager as well as the temporary directory path, as this is the most common use case, and in preparation for adding a make_sstable method in table_for_tests. Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
This commit is contained in:
@@ -144,7 +144,7 @@ SEASTAR_TEST_CASE(compaction_manager_basic_test) {
|
||||
auto s = make_shared_schema({}, some_keyspace, some_column_family,
|
||||
{{"p1", utf8_type}}, {{"c1", utf8_type}}, {{"r1", int32_type}}, {}, utf8_type);
|
||||
|
||||
table_for_tests cf(env.manager(), s, env.tempdir().path().string());
|
||||
auto cf = env.make_table_for_tests(s);
|
||||
auto& cm = cf.get_compaction_manager();
|
||||
auto close_cf = deferred_stop(cf);
|
||||
cf->set_compaction_strategy(sstables::compaction_strategy_type::size_tiered);
|
||||
@@ -208,7 +208,7 @@ SEASTAR_TEST_CASE(compact) {
|
||||
builder.set_comment("Example table for compaction");
|
||||
builder.set_gc_grace_seconds(std::numeric_limits<int32_t>::max());
|
||||
auto s = builder.build();
|
||||
table_for_tests cf(env.manager(), s);
|
||||
auto cf = env.make_table_for_tests(s);
|
||||
auto close_cf = deferred_stop(cf);
|
||||
|
||||
auto sstables = open_sstables(env, s, "test/resource/sstables/compaction", {1,2,3}).get();
|
||||
@@ -307,7 +307,7 @@ static future<std::vector<unsigned long>> compact_sstables(test_env& env, std::v
|
||||
builder.set_min_compaction_threshold(4);
|
||||
auto s = builder.build(schema_builder::compact_storage::no);
|
||||
|
||||
auto cf = table_for_tests(env.manager(), s);
|
||||
auto cf = env.make_table_for_tests(s);
|
||||
auto stop_cf = deferred_stop(cf);
|
||||
|
||||
std::vector<sstables::shared_sstable> sstables;
|
||||
@@ -514,7 +514,7 @@ static bool sstable_overlaps(const lw_shared_ptr<replica::column_family>& cf, in
|
||||
SEASTAR_TEST_CASE(leveled_01) {
|
||||
BOOST_REQUIRE_EQUAL(smp::count, 1);
|
||||
return test_env::do_with_async([] (test_env& env) {
|
||||
table_for_tests cf(env.manager());
|
||||
auto cf = env.make_table_for_tests();
|
||||
auto stop_cf = deferred_stop(cf);
|
||||
|
||||
const auto keys = tests::generate_partition_keys(50, cf.schema());
|
||||
@@ -556,7 +556,7 @@ SEASTAR_TEST_CASE(leveled_01) {
|
||||
SEASTAR_TEST_CASE(leveled_02) {
|
||||
BOOST_REQUIRE_EQUAL(smp::count, 1);
|
||||
return test_env::do_with_async([] (test_env& env) {
|
||||
table_for_tests cf(env.manager());
|
||||
auto cf = env.make_table_for_tests();
|
||||
auto stop_cf = deferred_stop(cf);
|
||||
|
||||
const auto keys = tests::generate_partition_keys(50, cf.schema());
|
||||
@@ -608,7 +608,7 @@ SEASTAR_TEST_CASE(leveled_02) {
|
||||
SEASTAR_TEST_CASE(leveled_03) {
|
||||
BOOST_REQUIRE_EQUAL(smp::count, 1);
|
||||
return test_env::do_with_async([] (test_env& env) {
|
||||
table_for_tests cf(env.manager());
|
||||
auto cf = env.make_table_for_tests();
|
||||
auto stop_cf = deferred_stop(cf);
|
||||
|
||||
const auto keys = tests::generate_partition_keys(50, cf.schema());
|
||||
@@ -664,7 +664,7 @@ SEASTAR_TEST_CASE(leveled_03) {
|
||||
SEASTAR_TEST_CASE(leveled_04) {
|
||||
BOOST_REQUIRE_EQUAL(smp::count, 1);
|
||||
return test_env::do_with_async([] (test_env& env) {
|
||||
table_for_tests cf(env.manager());
|
||||
auto cf = env.make_table_for_tests();
|
||||
auto stop_cf = deferred_stop(cf);
|
||||
|
||||
const auto keys = tests::generate_partition_keys(50, cf.schema());
|
||||
@@ -744,7 +744,7 @@ SEASTAR_TEST_CASE(leveled_05) {
|
||||
SEASTAR_TEST_CASE(leveled_06) {
|
||||
// Test that we can compact a single L1 compaction into an empty L2.
|
||||
return test_env::do_with_async([] (test_env& env) {
|
||||
table_for_tests cf(env.manager());
|
||||
auto cf = env.make_table_for_tests();
|
||||
auto stop_cf = deferred_stop(cf);
|
||||
|
||||
auto max_sstable_size_in_mb = 1;
|
||||
@@ -776,7 +776,7 @@ SEASTAR_TEST_CASE(leveled_06) {
|
||||
|
||||
SEASTAR_TEST_CASE(leveled_07) {
|
||||
return test_env::do_with_async([] (test_env& env) {
|
||||
table_for_tests cf(env.manager());
|
||||
auto cf = env.make_table_for_tests();
|
||||
auto stop_cf = deferred_stop(cf);
|
||||
|
||||
const auto key = tests::generate_partition_key(cf.schema());
|
||||
@@ -800,7 +800,7 @@ SEASTAR_TEST_CASE(leveled_07) {
|
||||
|
||||
SEASTAR_TEST_CASE(leveled_invariant_fix) {
|
||||
return test_env::do_with_async([] (test_env& env) {
|
||||
table_for_tests cf(env.manager());
|
||||
auto cf = env.make_table_for_tests();
|
||||
auto stop_cf = deferred_stop(cf);
|
||||
|
||||
auto sstables_no = cf.schema()->max_compaction_threshold();
|
||||
@@ -840,7 +840,7 @@ SEASTAR_TEST_CASE(leveled_stcs_on_L0) {
|
||||
builder.set_min_compaction_threshold(4);
|
||||
auto s = builder.build(schema_builder::compact_storage::no);
|
||||
|
||||
table_for_tests cf(env.manager(), s);
|
||||
auto cf = env.make_table_for_tests(s);
|
||||
auto stop_cf = deferred_stop(cf);
|
||||
|
||||
const auto keys = tests::generate_partition_keys(1, cf.schema());
|
||||
@@ -883,7 +883,7 @@ SEASTAR_TEST_CASE(leveled_stcs_on_L0) {
|
||||
|
||||
SEASTAR_TEST_CASE(overlapping_starved_sstables_test) {
|
||||
return test_env::do_with_async([] (test_env& env) {
|
||||
table_for_tests cf(env.manager());
|
||||
auto cf = env.make_table_for_tests();
|
||||
auto stop_cf = deferred_stop(cf);
|
||||
|
||||
const auto keys = tests::generate_partition_keys(5, cf.schema());
|
||||
@@ -915,7 +915,7 @@ SEASTAR_TEST_CASE(overlapping_starved_sstables_test) {
|
||||
|
||||
SEASTAR_TEST_CASE(check_overlapping) {
|
||||
return test_env::do_with_async([] (test_env& env) {
|
||||
table_for_tests cf(env.manager());
|
||||
auto cf = env.make_table_for_tests();
|
||||
auto stop_cf = deferred_stop(cf);
|
||||
|
||||
const auto keys = tests::generate_partition_keys(4, cf.schema());
|
||||
@@ -953,7 +953,7 @@ SEASTAR_TEST_CASE(tombstone_purge_test) {
|
||||
};
|
||||
|
||||
auto compact = [&, s] (std::vector<shared_sstable> all, std::vector<shared_sstable> to_compact) -> std::vector<shared_sstable> {
|
||||
table_for_tests cf(env.manager(), s);
|
||||
auto cf = env.make_table_for_tests(s);
|
||||
auto stop_cf = deferred_stop(cf);
|
||||
for (auto&& sst : all) {
|
||||
column_family_test(cf).add_sstable(sst).get();
|
||||
@@ -1164,7 +1164,7 @@ SEASTAR_TEST_CASE(sstable_rewrite) {
|
||||
new_tables.emplace_back(sst);
|
||||
return sst;
|
||||
};
|
||||
auto cf = table_for_tests(env.manager(), s);
|
||||
auto cf = env.make_table_for_tests(s);
|
||||
auto stop_cf = deferred_stop(cf);
|
||||
std::vector<shared_sstable> sstables;
|
||||
sstables.push_back(std::move(sstp));
|
||||
@@ -1197,7 +1197,7 @@ SEASTAR_TEST_CASE(test_sstable_max_local_deletion_time_2) {
|
||||
builder.with_column("c1", utf8_type, column_kind::clustering_key);
|
||||
builder.with_column("r1", utf8_type);
|
||||
schema_ptr s = builder.build(schema_builder::compact_storage::no);
|
||||
table_for_tests cf(env.manager(), s);
|
||||
auto cf = env.make_table_for_tests(s);
|
||||
auto close_cf = deferred_stop(cf);
|
||||
auto mt = make_lw_shared<replica::memtable>(s);
|
||||
auto now = gc_clock::now();
|
||||
@@ -1262,7 +1262,7 @@ SEASTAR_TEST_CASE(get_fully_expired_sstables_test) {
|
||||
auto t4 = gc_clock::from_time_t(30).time_since_epoch().count();
|
||||
|
||||
{
|
||||
table_for_tests cf(env.manager());
|
||||
auto cf = env.make_table_for_tests();
|
||||
auto close_cf = deferred_stop(cf);
|
||||
|
||||
auto sst1 = add_sstable_for_overlapping_test(env, cf, /*gen*/1, min_key.key(), keys[1].key(), build_stats(t0, t1, t1));
|
||||
@@ -1274,7 +1274,7 @@ SEASTAR_TEST_CASE(get_fully_expired_sstables_test) {
|
||||
}
|
||||
|
||||
{
|
||||
table_for_tests cf(env.manager());
|
||||
auto cf = env.make_table_for_tests();
|
||||
auto close_cf = deferred_stop(cf);
|
||||
|
||||
auto sst1 = add_sstable_for_overlapping_test(env, cf, /*gen*/1, min_key.key(), keys[1].key(), build_stats(t0, t1, t1));
|
||||
@@ -1314,7 +1314,7 @@ SEASTAR_TEST_CASE(compaction_with_fully_expired_table) {
|
||||
write_memtable_to_sstable_for_test(*mt, sst).get();
|
||||
sst = env.reusable_sst(sst).get0();
|
||||
|
||||
table_for_tests cf(env.manager(), s);
|
||||
auto cf = env.make_table_for_tests(s);
|
||||
auto close_cf = deferred_stop(cf);
|
||||
|
||||
auto ssts = std::vector<shared_sstable>{ sst };
|
||||
@@ -1336,7 +1336,7 @@ SEASTAR_TEST_CASE(basic_date_tiered_strategy_test) {
|
||||
{{"p1", utf8_type}}, {}, {}, {}, utf8_type));
|
||||
builder.set_min_compaction_threshold(4);
|
||||
auto s = builder.build(schema_builder::compact_storage::no);
|
||||
table_for_tests cf(env.manager(), s);
|
||||
auto cf = env.make_table_for_tests(s);
|
||||
auto stop_cf = deferred_stop(cf);
|
||||
|
||||
std::vector<sstables::shared_sstable> candidates;
|
||||
@@ -1374,7 +1374,7 @@ SEASTAR_TEST_CASE(date_tiered_strategy_test_2) {
|
||||
{{"p1", utf8_type}}, {}, {}, {}, utf8_type));
|
||||
builder.set_min_compaction_threshold(4);
|
||||
auto s = builder.build(schema_builder::compact_storage::no);
|
||||
table_for_tests cf(env.manager(), s);
|
||||
auto cf = env.make_table_for_tests(s);
|
||||
auto stop_cf = deferred_stop(cf);
|
||||
|
||||
// deterministic timestamp for Fri, 01 Jan 2016 00:00:00 GMT.
|
||||
@@ -1522,7 +1522,7 @@ SEASTAR_TEST_CASE(time_window_strategy_correctness_test) {
|
||||
std::map<sstring, sstring> options;
|
||||
time_window_compaction_strategy twcs(options);
|
||||
std::map<api::timestamp_type, std::vector<shared_sstable>> buckets;
|
||||
table_for_tests cf(env.manager(), s);
|
||||
auto cf = env.make_table_for_tests(s);
|
||||
auto close_cf = deferred_stop(cf);
|
||||
auto control = make_strategy_control_for_test(false);
|
||||
|
||||
@@ -1616,7 +1616,7 @@ SEASTAR_TEST_CASE(time_window_strategy_size_tiered_behavior_correctness) {
|
||||
buckets[bound].push_back(std::move(sst));
|
||||
};
|
||||
|
||||
table_for_tests cf(env.manager(), s);
|
||||
auto cf = env.make_table_for_tests(s);
|
||||
auto close_cf = deferred_stop(cf);
|
||||
auto major_compact_bucket = [&] (api::timestamp_type window_ts) {
|
||||
auto bound = time_window_compaction_strategy::get_window_lower_bound(window_size, window_ts);
|
||||
@@ -1686,7 +1686,7 @@ SEASTAR_TEST_CASE(min_max_clustering_key_test_2) {
|
||||
.with_column("ck1", utf8_type, column_kind::clustering_key)
|
||||
.with_column("r1", int32_type)
|
||||
.build();
|
||||
table_for_tests cf(env.manager(), s);
|
||||
auto cf = env.make_table_for_tests(s);
|
||||
auto close_cf = deferred_stop(cf);
|
||||
auto mt = make_lw_shared<replica::memtable>(s);
|
||||
const column_definition &r1_col = *s->get_column_definition("r1");
|
||||
@@ -1728,7 +1728,7 @@ SEASTAR_TEST_CASE(min_max_clustering_key_test_2) {
|
||||
|
||||
SEASTAR_TEST_CASE(size_tiered_beyond_max_threshold_test) {
|
||||
return test_env::do_with_async([] (test_env& env) {
|
||||
table_for_tests cf(env.manager());
|
||||
auto cf = env.make_table_for_tests();
|
||||
auto stop_cf = deferred_stop(cf);
|
||||
auto cs = sstables::make_compaction_strategy(sstables::compaction_strategy_type::size_tiered, cf.schema()->compaction_strategy_options());
|
||||
|
||||
@@ -1791,7 +1791,7 @@ SEASTAR_TEST_CASE(sstable_expired_data_ratio) {
|
||||
run.insert(sst);
|
||||
BOOST_REQUIRE(std::fabs(run.estimate_droppable_tombstone_ratio(gc_before) - expired) <= 0.1);
|
||||
|
||||
table_for_tests cf(env.manager(), s);
|
||||
auto cf = env.make_table_for_tests(s);
|
||||
auto close_cf = deferred_stop(cf);
|
||||
auto creator = [&, gen = make_lw_shared<unsigned>(2)] {
|
||||
auto sst = env.make_sstable(s, (*gen)++);
|
||||
@@ -1867,7 +1867,7 @@ SEASTAR_TEST_CASE(compaction_correctness_with_partitioned_sstable_set) {
|
||||
auto compact = [&, s] (std::vector<shared_sstable> all) -> std::vector<shared_sstable> {
|
||||
// NEEDED for partitioned_sstable_set to actually have an effect
|
||||
std::for_each(all.begin(), all.end(), [] (auto& sst) { sst->set_sstable_level(1); });
|
||||
table_for_tests cf(env.manager(), s);
|
||||
auto cf = env.make_table_for_tests(s);
|
||||
auto close_cf = deferred_stop(cf);
|
||||
return compact_sstables(sstables::compaction_descriptor(std::move(all), default_priority_class(), 0, 0 /*std::numeric_limits<uint64_t>::max()*/),
|
||||
cf, sst_gen).get0().new_sstables;
|
||||
@@ -1985,7 +1985,7 @@ SEASTAR_TEST_CASE(sstable_cleanup_correctness_test) {
|
||||
auto sst = make_sstable_containing(sst_gen, mutations);
|
||||
auto run_identifier = sst->run_identifier();
|
||||
|
||||
table_for_tests cf(env.manager(), s, env.tempdir().path().string());
|
||||
auto cf = env.make_table_for_tests(s);
|
||||
auto close_cf = deferred_stop(cf);
|
||||
cf->start();
|
||||
|
||||
@@ -2130,7 +2130,7 @@ SEASTAR_TEST_CASE(sstable_scrub_validate_mode_test) {
|
||||
|
||||
testlog.info("Loaded sstable {}", sst->get_filename());
|
||||
|
||||
table_for_tests table(env.manager(), schema, env.tempdir().path().string());
|
||||
auto table = env.make_table_for_tests(schema);
|
||||
auto close_cf = deferred_stop(table);
|
||||
table->start();
|
||||
|
||||
@@ -2321,7 +2321,7 @@ SEASTAR_TEST_CASE(sstable_scrub_skip_mode_test) {
|
||||
|
||||
testlog.info("Loaded sstable {}", sst->get_filename());
|
||||
|
||||
table_for_tests table(env.manager(), schema, env.tempdir().path().string());
|
||||
auto table = env.make_table_for_tests(schema);
|
||||
auto close_cf = deferred_stop(table);
|
||||
table->start();
|
||||
auto& compaction_manager = table.get_compaction_manager();
|
||||
@@ -2412,7 +2412,7 @@ SEASTAR_TEST_CASE(sstable_scrub_segregate_mode_test) {
|
||||
|
||||
testlog.info("Loaded sstable {}", sst->get_filename());
|
||||
|
||||
table_for_tests table(env.manager(), schema, env.tempdir().path().string());
|
||||
auto table = env.make_table_for_tests(schema);
|
||||
auto close_cf = deferred_stop(table);
|
||||
table->start();
|
||||
auto& compaction_manager = table.get_compaction_manager();
|
||||
@@ -2518,7 +2518,7 @@ SEASTAR_TEST_CASE(sstable_scrub_quarantine_mode_test) {
|
||||
|
||||
testlog.info("Loaded sstable {}", sst->get_filename());
|
||||
|
||||
table_for_tests table(env.manager(), schema, env.tempdir().path().string());
|
||||
auto table = env.make_table_for_tests(schema);
|
||||
auto close_cf = deferred_stop(table);
|
||||
table->start();
|
||||
auto& compaction_manager = table.get_compaction_manager();
|
||||
@@ -2850,7 +2850,7 @@ SEASTAR_TEST_CASE(sstable_run_based_compaction_test) {
|
||||
};
|
||||
|
||||
auto tracker = make_lw_shared<cache_tracker>();
|
||||
table_for_tests cf(env.manager(), s);
|
||||
auto cf = env.make_table_for_tests(s);
|
||||
auto close_cf = deferred_stop(cf);
|
||||
cf->mark_ready_for_writes();
|
||||
cf->start();
|
||||
@@ -2986,7 +2986,7 @@ SEASTAR_TEST_CASE(compaction_strategy_aware_major_compaction_test) {
|
||||
sst2->set_sstable_level(3);
|
||||
auto candidates = std::vector<sstables::shared_sstable>({ sst, sst2 });
|
||||
|
||||
table_for_tests cf(env.manager());
|
||||
auto cf = env.make_table_for_tests();
|
||||
auto close_cf = deferred_stop(cf);
|
||||
|
||||
{
|
||||
@@ -3019,7 +3019,7 @@ SEASTAR_TEST_CASE(backlog_tracker_correctness_after_changing_compaction_strategy
|
||||
return sst;
|
||||
};
|
||||
|
||||
table_for_tests cf(env.manager(), s);
|
||||
auto cf = env.make_table_for_tests(s);
|
||||
auto close_cf = deferred_stop(cf);
|
||||
cf->set_compaction_strategy(sstables::compaction_strategy_type::leveled);
|
||||
|
||||
@@ -3070,7 +3070,7 @@ SEASTAR_TEST_CASE(partial_sstable_run_filtered_out_test) {
|
||||
.with_column("id", utf8_type, column_kind::partition_key)
|
||||
.with_column("value", int32_type).build();
|
||||
|
||||
table_for_tests cf(env.manager(), s, env.tempdir().path().string());
|
||||
auto cf = env.make_table_for_tests(s);
|
||||
auto close_cf = deferred_stop(cf);
|
||||
cf->start();
|
||||
|
||||
@@ -3313,7 +3313,7 @@ SEASTAR_TEST_CASE(incremental_compaction_data_resurrection_test) {
|
||||
// make mut1_deletion gc'able.
|
||||
forward_jump_clocks(std::chrono::seconds(ttl));
|
||||
|
||||
table_for_tests cf(env.manager(), s, env.tempdir().path().string());
|
||||
auto cf = env.make_table_for_tests(s);
|
||||
auto close_cf = deferred_stop(cf);
|
||||
cf->start();
|
||||
cf->set_compaction_strategy(sstables::compaction_strategy_type::null);
|
||||
@@ -3415,7 +3415,7 @@ SEASTAR_TEST_CASE(twcs_major_compaction_test) {
|
||||
auto mut3 = make_insert(0ms);
|
||||
auto mut4 = make_insert(1ms);
|
||||
|
||||
table_for_tests cf(env.manager(), s, env.tempdir().path().string());
|
||||
auto cf = env.make_table_for_tests(s);
|
||||
auto close_cf = deferred_stop(cf);
|
||||
cf->start();
|
||||
cf->set_compaction_strategy(sstables::compaction_strategy_type::time_window);
|
||||
@@ -3438,7 +3438,8 @@ SEASTAR_TEST_CASE(autocompaction_control_test) {
|
||||
.with_column("value", int32_type)
|
||||
.build();
|
||||
|
||||
table_for_tests cf(env.manager(), s, env.tempdir().path().string());
|
||||
auto tmp = tmpdir();
|
||||
auto cf = env.make_table_for_tests(s);
|
||||
auto& cm = cf.get_compaction_manager();
|
||||
auto close_cf = deferred_stop(cf);
|
||||
cf->set_compaction_strategy(sstables::compaction_strategy_type::size_tiered);
|
||||
@@ -3526,7 +3527,7 @@ SEASTAR_TEST_CASE(test_bug_6472) {
|
||||
return m;
|
||||
};
|
||||
|
||||
table_for_tests cf(env.manager(), s, env.tempdir().path().native());
|
||||
auto cf = env.make_table_for_tests(s);
|
||||
auto close_cf = deferred_stop(cf);
|
||||
cf->start();
|
||||
|
||||
@@ -3639,7 +3640,7 @@ SEASTAR_TEST_CASE(test_twcs_partition_estimate) {
|
||||
return make_sstable_containing(sst_gen, {m});
|
||||
};
|
||||
|
||||
table_for_tests cf(env.manager(), s, env.tempdir().path().native());
|
||||
auto cf = env.make_table_for_tests(s);
|
||||
auto close_cf = deferred_stop(cf);
|
||||
cf->start();
|
||||
|
||||
@@ -3756,7 +3757,7 @@ SEASTAR_TEST_CASE(test_twcs_interposer_on_memtable_flush) {
|
||||
};
|
||||
|
||||
auto _ = env.tempdir().make_sweeper();
|
||||
table_for_tests cf(env.manager(), s, env.tempdir().path().string());
|
||||
auto cf = env.make_table_for_tests(s);
|
||||
auto close_cf = deferred_stop(cf);
|
||||
cf->start();
|
||||
|
||||
@@ -3810,7 +3811,7 @@ SEASTAR_TEST_CASE(test_twcs_compaction_across_buckets) {
|
||||
return m;
|
||||
};
|
||||
|
||||
table_for_tests cf(env.manager(), s);
|
||||
auto cf = env.make_table_for_tests(s);
|
||||
auto close_cf = deferred_stop(cf);
|
||||
|
||||
constexpr unsigned windows = 10;
|
||||
@@ -3851,7 +3852,7 @@ SEASTAR_TEST_CASE(test_offstrategy_sstable_compaction) {
|
||||
auto mut = mutation(s, pk);
|
||||
ss.add_row(mut, ss.make_ckey(0), "val");
|
||||
|
||||
table_for_tests cf(env.manager(), s, tmp.path().string());
|
||||
auto cf = env.make_table_for_tests(s, tmp.path().string());
|
||||
auto close_cf = deferred_stop(cf);
|
||||
auto sst_gen = [&env, s, cf, path = tmp.path().string(), version] () mutable {
|
||||
return env.make_sstable(s, path, column_family_test::calculate_generation_for_new_table(*cf), version);
|
||||
@@ -4117,7 +4118,7 @@ SEASTAR_TEST_CASE(test_twcs_single_key_reader_filtering) {
|
||||
auto sst2 = make_sstable_containing(sst_gen, {make_row(0, 1)});
|
||||
auto dkey = sst1->get_first_decorated_key();
|
||||
|
||||
table_for_tests cf(env.manager(), s, env.tempdir().path().string());
|
||||
auto cf = env.make_table_for_tests(s);
|
||||
auto close_cf = deferred_stop(cf);
|
||||
cf->start();
|
||||
|
||||
@@ -4425,7 +4426,7 @@ SEASTAR_TEST_CASE(twcs_single_key_reader_through_compound_set_test) {
|
||||
return m;
|
||||
};
|
||||
|
||||
table_for_tests cf(env.manager(), s, env.tempdir().path().string());
|
||||
auto cf = env.make_table_for_tests(s);
|
||||
auto close_cf = deferred_stop(cf);
|
||||
cf->start();
|
||||
|
||||
@@ -4472,7 +4473,7 @@ SEASTAR_TEST_CASE(test_major_does_not_miss_data_in_memtable) {
|
||||
|
||||
auto pkey = tests::generate_partition_key(s);
|
||||
|
||||
table_for_tests cf(env.manager(), s, env.tempdir().path().string());
|
||||
auto cf = env.make_table_for_tests(s);
|
||||
auto close_cf = deferred_stop(cf);
|
||||
auto sst_gen = [&env, &cf, s] () mutable {
|
||||
return env.make_sstable(s, column_family_test::calculate_generation_for_new_table(*cf));
|
||||
@@ -4546,7 +4547,7 @@ SEASTAR_TEST_CASE(simple_backlog_controller_test) {
|
||||
simple_schema ss;
|
||||
auto s = ss.schema();
|
||||
|
||||
table_for_tests t(env.manager(), s, "");
|
||||
auto t = env.make_table_for_tests(s);
|
||||
t->start();
|
||||
t->set_compaction_strategy(compaction_strategy_type);
|
||||
return t;
|
||||
@@ -4643,7 +4644,7 @@ SEASTAR_TEST_CASE(test_compaction_strategy_cleanup_method) {
|
||||
auto _ = env.tempdir().make_sweeper();
|
||||
auto keys = tests::generate_partition_keys(all_files, s);
|
||||
|
||||
table_for_tests cf(env.manager(), s, env.tempdir().path().string());
|
||||
auto cf = env.make_table_for_tests(s);
|
||||
auto close_cf = deferred_stop(cf);
|
||||
auto sst_gen = [&env, &cf, s]() mutable {
|
||||
return env.make_sstable(s, column_family_test::calculate_generation_for_new_table(*cf));
|
||||
@@ -4733,7 +4734,7 @@ SEASTAR_TEST_CASE(test_large_partition_splitting_on_compaction) {
|
||||
return env.make_sstable(s, (*gen)++);
|
||||
};
|
||||
auto pkey = tests::generate_partition_key(s);
|
||||
table_for_tests cf(env.manager(), s);
|
||||
auto cf = env.make_table_for_tests(s);
|
||||
auto close_cf = deferred_stop(cf);
|
||||
|
||||
auto get_next_ckey = [&] {
|
||||
@@ -4861,7 +4862,7 @@ SEASTAR_TEST_CASE(check_table_sstable_set_includes_maintenance_sstables) {
|
||||
mut1.partition().apply_insert(*s, ss.make_ckey(0), ss.new_timestamp());
|
||||
auto sst = make_sstable_containing(env.make_sstable(s), {std::move(mut1)});
|
||||
|
||||
table_for_tests cf(env.manager(), s);
|
||||
auto cf = env.make_table_for_tests(s);
|
||||
auto close_cf = deferred_stop(cf);
|
||||
|
||||
cf->add_sstable_and_update_cache(sst, sstables::offstrategy::yes).get();
|
||||
|
||||
@@ -52,7 +52,7 @@ void run_sstable_resharding_test() {
|
||||
for (const auto version : writable_sstable_versions) {
|
||||
auto tmp = tmpdir();
|
||||
auto s = get_schema();
|
||||
table_for_tests cf(env.manager(), s);
|
||||
auto cf = env.make_table_for_tests(s);
|
||||
auto close_cf = deferred_stop(cf);
|
||||
std::unordered_map<shard_id, std::vector<mutation>> muts;
|
||||
static constexpr auto keys_per_shard = 1000u;
|
||||
|
||||
@@ -185,6 +185,10 @@ public:
|
||||
return func(env);
|
||||
});
|
||||
}
|
||||
|
||||
table_for_tests make_table_for_tests(schema_ptr s = nullptr, std::optional<sstring> dir = std::nullopt) {
|
||||
return table_for_tests(manager(), s, dir.value_or(tempdir().path().native()));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace sstables
|
||||
|
||||
@@ -116,7 +116,7 @@ public:
|
||||
table_for_tests::table_for_tests(sstables::sstables_manager& sstables_manager, schema_ptr s, std::optional<sstring> datadir)
|
||||
: _data(make_lw_shared<data>())
|
||||
{
|
||||
_data->s = s;
|
||||
_data->s = s ? s : make_default_schema();
|
||||
_data->cfg = replica::table::config{.compaction_concurrency_semaphore = &_data->semaphore};
|
||||
_data->cfg.enable_disk_writes = bool(datadir);
|
||||
_data->cfg.datadir = datadir.value_or(sstring());
|
||||
|
||||
Reference in New Issue
Block a user