Merge 'Sanitize sstables-making utils in tests' from Pavel Emelyanov
There are tons of wrappers that help test cases make sstables for their needs. And lots of code duplication in test cases that do parts of those helpers' work on their own. This set cleans some bits of those Closes #14280 * github.com:scylladb/scylladb: test/utils: Generalize making memtable from vector<mutation> test/util: Generalize make_sstable_easy()-s test/sstable_mutation: Remove useless helper test/sstable_mutation: Make writer config in make_sstable_mutation_source() test/utils: De-duplicate make_sstable_containing-s test/sstable_compaction: Remove useless one-line local lambda test/sstable_compaction: Simplify sstable making test/sstables*: Make sstable from vector of mutations test/mutation_reader: Remove create_sstable() helper from test
This commit is contained in:
@@ -975,13 +975,6 @@ SEASTAR_TEST_CASE(reader_selector_fast_forwarding_test) {
|
||||
});
|
||||
}
|
||||
|
||||
static
|
||||
sstables::shared_sstable create_sstable(sstables::test_env& env, schema_ptr s, std::vector<mutation> mutations) {
|
||||
return make_sstable_containing([&] {
|
||||
return env.make_sstable(s);
|
||||
}, mutations);
|
||||
}
|
||||
|
||||
static mutation compacted(const mutation& m) {
|
||||
auto result = m;
|
||||
result.partition().compact_for_compaction(*result.schema(), always_gc, result.decorated_key(), gc_clock::now(), tombstone_gc_state(nullptr));
|
||||
@@ -1013,7 +1006,7 @@ SEASTAR_TEST_CASE(test_fast_forwarding_combined_reader_is_consistent_with_slicin
|
||||
combined[j++].apply(m);
|
||||
}
|
||||
}
|
||||
mutation_source ds = create_sstable(env, s, muts)->as_mutation_source();
|
||||
mutation_source ds = make_sstable_containing(env.make_sstable(s), muts)->as_mutation_source();
|
||||
reader_ranges.push_back(dht::partition_range::make({keys[0]}, {keys[0]}));
|
||||
readers.push_back(ds.make_reader_v2(s,
|
||||
permit,
|
||||
@@ -1083,8 +1076,8 @@ SEASTAR_TEST_CASE(test_combined_reader_slicing_with_overlapping_range_tombstones
|
||||
|
||||
std::vector<flat_mutation_reader_v2> readers;
|
||||
|
||||
mutation_source ds1 = create_sstable(env, s, {m1})->as_mutation_source();
|
||||
mutation_source ds2 = create_sstable(env, s, {m2})->as_mutation_source();
|
||||
mutation_source ds1 = make_sstable_containing(env.make_sstable(s), {m1})->as_mutation_source();
|
||||
mutation_source ds2 = make_sstable_containing(env.make_sstable(s), {m2})->as_mutation_source();
|
||||
|
||||
// upper bound ends before the row in m2, so that the raw is fetched after next fast forward.
|
||||
auto range = ss.make_ckey_range(0, 3);
|
||||
|
||||
@@ -33,13 +33,7 @@ SEASTAR_TEST_CASE(test_schema_changes) {
|
||||
shared_sstable created_with_base_schema;
|
||||
shared_sstable created_with_changed_schema;
|
||||
if (it == cache.end()) {
|
||||
auto mt = make_lw_shared<replica::memtable>(base);
|
||||
for (auto& m : base_mutations) {
|
||||
mt->apply(m);
|
||||
}
|
||||
|
||||
created_with_base_schema = make_sstable_containing(env.make_sstable(base), mt);
|
||||
|
||||
created_with_base_schema = make_sstable_containing(env.make_sstable(base), base_mutations);
|
||||
cache.emplace(std::tuple { version, base }, created_with_base_schema);
|
||||
} else {
|
||||
created_with_base_schema = it->second;
|
||||
|
||||
@@ -3353,15 +3353,12 @@ static void write_mut_and_validate(test_env& env, schema_ptr s, const sstring& t
|
||||
|
||||
static void write_mut_and_validate_version(test_env& env, schema_ptr s, const sstring& table_name, mutation& mut,
|
||||
sstable_version_types version, std::vector<bytes> min_components, std::vector<bytes> max_components) {
|
||||
lw_shared_ptr<replica::memtable> mt = make_lw_shared<replica::memtable>(s);
|
||||
mt->apply(mut);
|
||||
|
||||
// FIXME This used to `write_and_compare_sstables()` and to
|
||||
// additionally call `do_validate_stats_metadata()` on the result,
|
||||
// but cannot now because flat reader version tranforms rearrange
|
||||
// range tombstones. Revisit once the reader v2 migration is
|
||||
// complete and those version transforms are gone
|
||||
auto sst = write_sstables(env, s, mt, version);
|
||||
auto sst = make_sstable_containing(env.make_sstable(s, version), {mut});
|
||||
auto written_sst = validate_read(env, sst, {mut});
|
||||
check_min_max_column_names(written_sst, std::move(min_components), std::move(max_components));
|
||||
}
|
||||
|
||||
@@ -159,8 +159,6 @@ SEASTAR_TEST_CASE(compaction_manager_basic_test) {
|
||||
for (auto i : idx) {
|
||||
// create 4 sstables of similar size to be compacted later on.
|
||||
|
||||
auto mt = make_lw_shared<replica::memtable>(s);
|
||||
|
||||
const column_definition& r1_col = *s->get_column_definition("r1");
|
||||
|
||||
sstring k = "key" + to_sstring(i);
|
||||
@@ -169,9 +167,8 @@ SEASTAR_TEST_CASE(compaction_manager_basic_test) {
|
||||
|
||||
mutation m(s, key);
|
||||
m.set_clustered_cell(c_key, r1_col, make_atomic_cell(int32_type, int32_type->decompose(1)));
|
||||
mt->apply(std::move(m));
|
||||
|
||||
auto sst = make_sstable_containing(sst_gen, mt);
|
||||
auto sst = make_sstable_containing(sst_gen, {std::move(m)});
|
||||
column_family_test(cf).add_sstable(sst).get();
|
||||
}
|
||||
|
||||
@@ -326,8 +323,6 @@ static future<compact_sstables_result> compact_sstables(test_env& env, std::vect
|
||||
|
||||
if (create_sstables) {
|
||||
for (auto i = 0; i < create_sstables; i++) {
|
||||
auto mt = make_lw_shared<replica::memtable>(s);
|
||||
|
||||
const column_definition& r1_col = *s->get_column_definition("r1");
|
||||
|
||||
auto sst = sst_gen();
|
||||
@@ -337,9 +332,8 @@ static future<compact_sstables_result> compact_sstables(test_env& env, std::vect
|
||||
|
||||
mutation m(s, key);
|
||||
m.set_clustered_cell(c_key, r1_col, make_atomic_cell(utf8_type, bytes(min_sstable_size, 'a')));
|
||||
mt->apply(std::move(m));
|
||||
|
||||
sst = make_sstable_containing(sst, mt);
|
||||
sst = make_sstable_containing(sst, {std::move(m)});
|
||||
sstables.push_back(sst);
|
||||
}
|
||||
}
|
||||
@@ -1149,20 +1143,14 @@ SEASTAR_TEST_CASE(sstable_rewrite) {
|
||||
{{"p1", utf8_type}}, {{"c1", utf8_type}}, {{"r1", utf8_type}}, {}, utf8_type);
|
||||
auto sst_gen = env.make_sst_factory(s);
|
||||
|
||||
auto mt = make_lw_shared<replica::memtable>(s);
|
||||
|
||||
const column_definition& r1_col = *s->get_column_definition("r1");
|
||||
|
||||
auto key_for_this_shard = tests::generate_partition_keys(1, s);
|
||||
auto apply_key = [mt, s, &r1_col] (const dht::decorated_key& key) {
|
||||
auto c_key = clustering_key::from_exploded(*s, {to_bytes("c1")});
|
||||
mutation m(s, key);
|
||||
m.set_clustered_cell(c_key, r1_col, make_atomic_cell(utf8_type, bytes("a")));
|
||||
mt->apply(std::move(m));
|
||||
};
|
||||
apply_key(key_for_this_shard[0]);
|
||||
auto c_key = clustering_key::from_exploded(*s, {to_bytes("c1")});
|
||||
mutation mut(s, key_for_this_shard[0]);
|
||||
mut.set_clustered_cell(c_key, r1_col, make_atomic_cell(utf8_type, bytes("a")));
|
||||
|
||||
auto sstp = make_sstable_containing(sst_gen, mt);
|
||||
auto sstp = make_sstable_containing(sst_gen, {std::move(mut)});
|
||||
auto key = key_for_this_shard[0];
|
||||
std::vector<sstables::shared_sstable> new_tables;
|
||||
auto creator = [&] {
|
||||
@@ -1215,16 +1203,13 @@ SEASTAR_TEST_CASE(test_sstable_max_local_deletion_time_2) {
|
||||
make_atomic_cell(utf8_type, bytes(""), ttl, last_expiry));
|
||||
mt->apply(std::move(m));
|
||||
};
|
||||
auto get_usable_sst = [&] (lw_shared_ptr<replica::memtable> mt) {
|
||||
return make_sstable_containing(sst_gen, mt);
|
||||
};
|
||||
|
||||
mutation m(s, partition_key::from_exploded(*s, {to_bytes("deletetest")}));
|
||||
for (auto i = 0; i < 5; i++) {
|
||||
add_row(m, to_bytes("deletecolumn" + to_sstring(i)), 100);
|
||||
}
|
||||
add_row(m, to_bytes("todelete"), 1000);
|
||||
auto sst1 = get_usable_sst(mt);
|
||||
auto sst1 = make_sstable_containing(sst_gen, mt);
|
||||
BOOST_REQUIRE(last_expiry == sst1->get_stats_metadata().max_local_deletion_time);
|
||||
|
||||
mt = make_lw_shared<replica::memtable>(s);
|
||||
@@ -1232,7 +1217,7 @@ SEASTAR_TEST_CASE(test_sstable_max_local_deletion_time_2) {
|
||||
tombstone tomb(api::new_timestamp(), now);
|
||||
m.partition().apply_delete(*s, clustering_key::from_exploded(*s, {to_bytes("todelete")}), tomb);
|
||||
mt->apply(std::move(m));
|
||||
auto sst2 = get_usable_sst(mt);
|
||||
auto sst2 = make_sstable_containing(sst_gen, mt);
|
||||
BOOST_REQUIRE(now.time_since_epoch().count() == sst2->get_stats_metadata().max_local_deletion_time);
|
||||
|
||||
auto creator = sst_gen;
|
||||
@@ -1306,12 +1291,10 @@ SEASTAR_TEST_CASE(compaction_with_fully_expired_table) {
|
||||
auto c_key = clustering_key_prefix::from_exploded(*s, {to_bytes("c1")});
|
||||
auto sst_gen = env.make_sst_factory(s);
|
||||
|
||||
auto mt = make_lw_shared<replica::memtable>(s);
|
||||
mutation m(s, key);
|
||||
tombstone tomb(api::new_timestamp(), gc_clock::now() - std::chrono::seconds(3600));
|
||||
m.partition().apply_delete(*s, c_key, tomb);
|
||||
mt->apply(std::move(m));
|
||||
auto sst = make_sstable_containing(sst_gen, mt);
|
||||
auto sst = make_sstable_containing(sst_gen, {std::move(m)});
|
||||
|
||||
auto cf = env.make_table_for_tests(s);
|
||||
auto close_cf = deferred_stop(cf);
|
||||
|
||||
@@ -95,8 +95,6 @@ SEASTAR_TEST_CASE(datafile_generation_09) {
|
||||
auto s = make_shared_schema({}, some_keyspace, some_column_family,
|
||||
{{"p1", utf8_type}}, {{"c1", utf8_type}}, {{"r1", int32_type}}, {}, utf8_type);
|
||||
|
||||
auto mt = make_lw_shared<replica::memtable>(s);
|
||||
|
||||
const column_definition& r1_col = *s->get_column_definition("r1");
|
||||
|
||||
auto key = partition_key::from_exploded(*s, {to_bytes("key1")});
|
||||
@@ -104,9 +102,8 @@ SEASTAR_TEST_CASE(datafile_generation_09) {
|
||||
|
||||
mutation m(s, key);
|
||||
m.set_clustered_cell(c_key, r1_col, make_atomic_cell(int32_type, int32_type->decompose(1)));
|
||||
mt->apply(std::move(m));
|
||||
|
||||
auto sst = make_sstable_containing(env.make_sstable(s), mt);
|
||||
auto sst = make_sstable_containing(env.make_sstable(s), {std::move(m)});
|
||||
auto sst2 = env.reusable_sst(sst).get();
|
||||
|
||||
sstables::test(sst2).read_summary().get();
|
||||
@@ -422,17 +419,14 @@ SEASTAR_TEST_CASE(datafile_generation_47) {
|
||||
auto s = make_shared_schema({}, some_keyspace, some_column_family,
|
||||
{{"p1", utf8_type}}, {{"c1", utf8_type}}, {{"r1", utf8_type}}, {}, utf8_type);
|
||||
|
||||
auto mt = make_lw_shared<replica::memtable>(s);
|
||||
|
||||
const column_definition& r1_col = *s->get_column_definition("r1");
|
||||
|
||||
auto key = partition_key::from_exploded(*s, {to_bytes("key1")});
|
||||
auto c_key = clustering_key::from_exploded(*s, {to_bytes("c1")});
|
||||
mutation m(s, key);
|
||||
m.set_clustered_cell(c_key, r1_col, make_atomic_cell(utf8_type, bytes(512*1024, 'a')));
|
||||
mt->apply(std::move(m));
|
||||
|
||||
auto sstp = make_sstable_containing(env.make_sstable(s), mt);
|
||||
auto sstp = make_sstable_containing(env.make_sstable(s), {std::move(m)});
|
||||
auto reader = sstable_reader_v2(sstp, s, env.make_reader_permit());
|
||||
auto close_reader = deferred_close(reader);
|
||||
while (reader().get()) {
|
||||
@@ -448,8 +442,6 @@ SEASTAR_TEST_CASE(test_counter_write) {
|
||||
.with_column("r1", counter_type)
|
||||
.with_column("r2", counter_type)
|
||||
.build();
|
||||
auto mt = make_lw_shared<replica::memtable>(s);
|
||||
|
||||
auto& r1_col = *s->get_column_definition("r1");
|
||||
auto& r2_col = *s->get_column_definition("r2");
|
||||
|
||||
@@ -477,9 +469,7 @@ SEASTAR_TEST_CASE(test_counter_write) {
|
||||
|
||||
m.set_clustered_cell(c_key2, r1_col, make_dead_atomic_cell(1));
|
||||
|
||||
mt->apply(m);
|
||||
|
||||
auto sstp = make_sstable_containing(env.make_sstable(s), mt);
|
||||
auto sstp = make_sstable_containing(env.make_sstable(s), {m});
|
||||
assert_that(sstable_reader_v2(sstp, s, env.make_reader_permit()))
|
||||
.produces(m)
|
||||
.produces_end_of_stream();
|
||||
@@ -1124,74 +1114,60 @@ SEASTAR_TEST_CASE(sstable_tombstone_metadata_check) {
|
||||
BOOST_TEST_MESSAGE(fmt::format("version {}", version));
|
||||
|
||||
{
|
||||
auto mt = make_lw_shared<replica::memtable>(s);
|
||||
mutation m(s, key);
|
||||
tombstone tomb(api::new_timestamp(), gc_clock::now());
|
||||
m.partition().apply_delete(*s, c_key, tomb);
|
||||
mt->apply(std::move(m));
|
||||
auto sst = make_sstable_containing(sst_gen, mt);
|
||||
auto sst = make_sstable_containing(sst_gen, {std::move(m)});
|
||||
BOOST_REQUIRE(sst->get_stats_metadata().estimated_tombstone_drop_time.bin.size());
|
||||
check_min_max_column_names(sst, {"c1"}, {"c1"});
|
||||
}
|
||||
|
||||
{
|
||||
auto mt = make_lw_shared<replica::memtable>(s);
|
||||
mutation m(s, key);
|
||||
m.set_clustered_cell(c_key, r1_col, make_dead_atomic_cell(3600));
|
||||
mt->apply(std::move(m));
|
||||
auto sst = make_sstable_containing(sst_gen, mt);
|
||||
auto sst = make_sstable_containing(sst_gen, {std::move(m)});
|
||||
BOOST_REQUIRE(sst->get_stats_metadata().estimated_tombstone_drop_time.bin.size());
|
||||
check_min_max_column_names(sst, {"c1"}, {"c1"});
|
||||
}
|
||||
|
||||
{
|
||||
auto mt = make_lw_shared<replica::memtable>(s);
|
||||
mutation m(s, key);
|
||||
m.set_clustered_cell(c_key, r1_col, make_atomic_cell(int32_type, int32_type->decompose(1)));
|
||||
mt->apply(std::move(m));
|
||||
auto sst = make_sstable_containing(sst_gen, mt);
|
||||
auto sst = make_sstable_containing(sst_gen, {std::move(m)});
|
||||
BOOST_REQUIRE(!sst->get_stats_metadata().estimated_tombstone_drop_time.bin.size());
|
||||
check_min_max_column_names(sst, {"c1"}, {"c1"});
|
||||
}
|
||||
|
||||
{
|
||||
auto mt = make_lw_shared<replica::memtable>(s);
|
||||
|
||||
mutation m(s, key);
|
||||
tombstone tomb(api::new_timestamp(), gc_clock::now());
|
||||
m.partition().apply_delete(*s, c_key, tomb);
|
||||
mt->apply(std::move(m));
|
||||
|
||||
auto key2 = partition_key::from_exploded(*s, {to_bytes("key2")});
|
||||
mutation m2(s, key2);
|
||||
m2.set_clustered_cell(c_key, r1_col, make_atomic_cell(int32_type, int32_type->decompose(1)));
|
||||
mt->apply(std::move(m2));
|
||||
|
||||
auto sst = make_sstable_containing(sst_gen, mt);
|
||||
auto sst = make_sstable_containing(sst_gen, {std::move(m), std::move(m2)});
|
||||
BOOST_REQUIRE(sst->get_stats_metadata().estimated_tombstone_drop_time.bin.size());
|
||||
check_min_max_column_names(sst, {"c1"}, {"c1"});
|
||||
}
|
||||
|
||||
{
|
||||
auto mt = make_lw_shared<replica::memtable>(s);
|
||||
mutation m(s, key);
|
||||
tombstone tomb(api::new_timestamp(), gc_clock::now());
|
||||
m.partition().apply(tomb);
|
||||
mt->apply(std::move(m));
|
||||
auto sst = make_sstable_containing(sst_gen, mt);
|
||||
auto sst = make_sstable_containing(sst_gen, {std::move(m)});
|
||||
BOOST_REQUIRE(sst->get_stats_metadata().estimated_tombstone_drop_time.bin.size());
|
||||
check_min_max_column_names(sst, {}, {});
|
||||
}
|
||||
|
||||
{
|
||||
auto mt = make_lw_shared<replica::memtable>(s);
|
||||
mutation m(s, key);
|
||||
tombstone tomb(api::new_timestamp(), gc_clock::now());
|
||||
range_tombstone rt(clustering_key_prefix::from_single_value(*s, bytes(
|
||||
"a")), clustering_key_prefix::from_single_value(*s, bytes("a")), tomb);
|
||||
m.partition().apply_delete(*s, std::move(rt));
|
||||
mt->apply(std::move(m));
|
||||
auto sst = make_sstable_containing(sst_gen, mt);
|
||||
auto sst = make_sstable_containing(sst_gen, {std::move(m)});
|
||||
BOOST_REQUIRE(sst->get_stats_metadata().estimated_tombstone_drop_time.bin.size());
|
||||
if (version >= sstable_version_types::mc) {
|
||||
check_min_max_column_names(sst, {"a"}, {"a"});
|
||||
@@ -1199,7 +1175,6 @@ SEASTAR_TEST_CASE(sstable_tombstone_metadata_check) {
|
||||
}
|
||||
|
||||
{
|
||||
auto mt = make_lw_shared<replica::memtable>(s);
|
||||
mutation m(s, key);
|
||||
m.set_clustered_cell(c_key, r1_col, make_atomic_cell(int32_type, int32_type->decompose(1)));
|
||||
tombstone tomb(api::new_timestamp(), gc_clock::now());
|
||||
@@ -1208,8 +1183,7 @@ SEASTAR_TEST_CASE(sstable_tombstone_metadata_check) {
|
||||
clustering_key_prefix::from_single_value(*s, bytes("a")),
|
||||
tomb);
|
||||
m.partition().apply_delete(*s, std::move(rt));
|
||||
mt->apply(std::move(m));
|
||||
auto sst = make_sstable_containing(sst_gen, mt);
|
||||
auto sst = make_sstable_containing(sst_gen, {std::move(m)});
|
||||
BOOST_REQUIRE(sst->get_stats_metadata().estimated_tombstone_drop_time.bin.size());
|
||||
if (version >= sstable_version_types::mc) {
|
||||
check_min_max_column_names(sst, {"a"}, {"c1"});
|
||||
@@ -1217,7 +1191,6 @@ SEASTAR_TEST_CASE(sstable_tombstone_metadata_check) {
|
||||
}
|
||||
|
||||
{
|
||||
auto mt = make_lw_shared<replica::memtable>(s);
|
||||
mutation m(s, key);
|
||||
m.set_clustered_cell(c_key, r1_col, make_atomic_cell(int32_type, int32_type->decompose(1)));
|
||||
tombstone tomb(api::new_timestamp(), gc_clock::now());
|
||||
@@ -1226,8 +1199,7 @@ SEASTAR_TEST_CASE(sstable_tombstone_metadata_check) {
|
||||
clustering_key_prefix::from_single_value(*s, bytes("d")),
|
||||
tomb);
|
||||
m.partition().apply_delete(*s, std::move(rt));
|
||||
mt->apply(std::move(m));
|
||||
auto sst = make_sstable_containing(sst_gen, mt);
|
||||
auto sst = make_sstable_containing(sst_gen, {std::move(m)});
|
||||
BOOST_REQUIRE(sst->get_stats_metadata().estimated_tombstone_drop_time.bin.size());
|
||||
if (version >= sstable_version_types::mc) {
|
||||
check_min_max_column_names(sst, {"c"}, {"d"});
|
||||
@@ -1235,7 +1207,6 @@ SEASTAR_TEST_CASE(sstable_tombstone_metadata_check) {
|
||||
}
|
||||
|
||||
{
|
||||
auto mt = make_lw_shared<replica::memtable>(s);
|
||||
mutation m(s, key);
|
||||
m.set_clustered_cell(c_key, r1_col, make_atomic_cell(int32_type, int32_type->decompose(1)));
|
||||
tombstone tomb(api::new_timestamp(), gc_clock::now());
|
||||
@@ -1244,8 +1215,7 @@ SEASTAR_TEST_CASE(sstable_tombstone_metadata_check) {
|
||||
clustering_key_prefix::from_single_value(*s, bytes("z")),
|
||||
tomb);
|
||||
m.partition().apply_delete(*s, std::move(rt));
|
||||
mt->apply(std::move(m));
|
||||
auto sst = make_sstable_containing(sst_gen, mt);
|
||||
auto sst = make_sstable_containing(sst_gen, {std::move(m)});
|
||||
BOOST_REQUIRE(sst->get_stats_metadata().estimated_tombstone_drop_time.bin.size());
|
||||
if (version >= sstable_version_types::mc) {
|
||||
check_min_max_column_names(sst, {"c1"}, {"z"});
|
||||
@@ -1254,7 +1224,6 @@ SEASTAR_TEST_CASE(sstable_tombstone_metadata_check) {
|
||||
|
||||
if (version >= sstable_version_types::mc) {
|
||||
{
|
||||
auto mt = make_lw_shared<replica::memtable>(s);
|
||||
mutation m(s, key);
|
||||
m.set_clustered_cell(c_key, r1_col, make_atomic_cell(int32_type, int32_type->decompose(1)));
|
||||
tombstone tomb(api::new_timestamp(), gc_clock::now());
|
||||
@@ -1263,14 +1232,12 @@ SEASTAR_TEST_CASE(sstable_tombstone_metadata_check) {
|
||||
bound_view(clustering_key_prefix::from_single_value(*s, bytes("z")), bound_kind::incl_end),
|
||||
tomb);
|
||||
m.partition().apply_delete(*s, std::move(rt));
|
||||
mt->apply(std::move(m));
|
||||
auto sst = make_sstable_containing(sst_gen, mt);
|
||||
auto sst = make_sstable_containing(sst_gen, {std::move(m)});
|
||||
BOOST_REQUIRE(sst->get_stats_metadata().estimated_tombstone_drop_time.bin.size());
|
||||
check_min_max_column_names(sst, {}, {"z"});
|
||||
}
|
||||
|
||||
{
|
||||
auto mt = make_lw_shared<replica::memtable>(s);
|
||||
mutation m(s, key);
|
||||
m.set_clustered_cell(c_key, r1_col, make_atomic_cell(int32_type, int32_type->decompose(1)));
|
||||
tombstone tomb(api::new_timestamp(), gc_clock::now());
|
||||
@@ -1279,20 +1246,17 @@ SEASTAR_TEST_CASE(sstable_tombstone_metadata_check) {
|
||||
bound_view::top(),
|
||||
tomb);
|
||||
m.partition().apply_delete(*s, std::move(rt));
|
||||
mt->apply(std::move(m));
|
||||
auto sst = make_sstable_containing(sst_gen, mt);
|
||||
auto sst = make_sstable_containing(sst_gen, {std::move(m)});
|
||||
BOOST_REQUIRE(sst->get_stats_metadata().estimated_tombstone_drop_time.bin.size());
|
||||
check_min_max_column_names(sst, {"a"}, {});
|
||||
}
|
||||
|
||||
{
|
||||
auto mt = make_lw_shared<replica::memtable>(s);
|
||||
mutation m(s, key);
|
||||
m.set_clustered_cell(c_key, r1_col, make_atomic_cell(int32_type, int32_type->decompose(1)));
|
||||
tombstone tomb(api::new_timestamp(), gc_clock::now());
|
||||
m.partition().apply_delete(*s, clustering_key_prefix::make_empty(), tomb);
|
||||
mt->apply(std::move(m));
|
||||
auto sst = make_sstable_containing(sst_gen, mt);
|
||||
auto sst = make_sstable_containing(sst_gen, {std::move(m)});
|
||||
BOOST_REQUIRE(sst->get_stats_metadata().estimated_tombstone_drop_time.bin.size());
|
||||
check_min_max_column_names(sst, {}, {});
|
||||
}
|
||||
@@ -1318,67 +1282,54 @@ SEASTAR_TEST_CASE(sstable_composite_tombstone_metadata_check) {
|
||||
BOOST_TEST_MESSAGE(fmt::format("version {}", version));
|
||||
|
||||
{
|
||||
auto mt = make_lw_shared<replica::memtable>(s);
|
||||
mutation m(s, key);
|
||||
tombstone tomb(api::new_timestamp(), gc_clock::now());
|
||||
m.partition().apply_delete(*s, c_key, tomb);
|
||||
mt->apply(std::move(m));
|
||||
auto sst = make_sstable_containing(sst_gen, mt);
|
||||
auto sst = make_sstable_containing(sst_gen, {std::move(m)});
|
||||
BOOST_REQUIRE(sst->get_stats_metadata().estimated_tombstone_drop_time.bin.size());
|
||||
check_min_max_column_names(sst, {"c1", "c2"}, {"c1", "c2"});
|
||||
}
|
||||
|
||||
{
|
||||
auto mt = make_lw_shared<replica::memtable>(s);
|
||||
mutation m(s, key);
|
||||
m.set_clustered_cell(c_key, r1_col, make_dead_atomic_cell(3600));
|
||||
mt->apply(std::move(m));
|
||||
auto sst = make_sstable_containing(sst_gen, mt);
|
||||
auto sst = make_sstable_containing(sst_gen, {std::move(m)});
|
||||
BOOST_REQUIRE(sst->get_stats_metadata().estimated_tombstone_drop_time.bin.size());
|
||||
check_min_max_column_names(sst, {"c1", "c2"}, {"c1", "c2"});
|
||||
}
|
||||
|
||||
{
|
||||
auto mt = make_lw_shared<replica::memtable>(s);
|
||||
mutation m(s, key);
|
||||
m.set_clustered_cell(c_key, r1_col, make_atomic_cell(int32_type, int32_type->decompose(1)));
|
||||
mt->apply(std::move(m));
|
||||
auto sst = make_sstable_containing(sst_gen, mt);
|
||||
auto sst = make_sstable_containing(sst_gen, {std::move(m)});
|
||||
BOOST_REQUIRE(!sst->get_stats_metadata().estimated_tombstone_drop_time.bin.size());
|
||||
check_min_max_column_names(sst, {"c1", "c2"}, {"c1", "c2"});
|
||||
}
|
||||
|
||||
{
|
||||
auto mt = make_lw_shared<replica::memtable>(s);
|
||||
|
||||
mutation m(s, key);
|
||||
tombstone tomb(api::new_timestamp(), gc_clock::now());
|
||||
m.partition().apply_delete(*s, c_key, tomb);
|
||||
mt->apply(std::move(m));
|
||||
|
||||
auto key2 = partition_key::from_exploded(*s, {to_bytes("key2")});
|
||||
mutation m2(s, key2);
|
||||
m2.set_clustered_cell(c_key, r1_col, make_atomic_cell(int32_type, int32_type->decompose(1)));
|
||||
mt->apply(std::move(m2));
|
||||
|
||||
auto sst = make_sstable_containing(sst_gen, mt);
|
||||
auto sst = make_sstable_containing(sst_gen, {std::move(m), std::move(m2)});
|
||||
BOOST_REQUIRE(sst->get_stats_metadata().estimated_tombstone_drop_time.bin.size());
|
||||
check_min_max_column_names(sst, {"c1", "c2"}, {"c1", "c2"});
|
||||
}
|
||||
|
||||
{
|
||||
auto mt = make_lw_shared<replica::memtable>(s);
|
||||
mutation m(s, key);
|
||||
tombstone tomb(api::new_timestamp(), gc_clock::now());
|
||||
m.partition().apply(tomb);
|
||||
mt->apply(std::move(m));
|
||||
auto sst = make_sstable_containing(sst_gen, mt);
|
||||
auto sst = make_sstable_containing(sst_gen, {std::move(m)});
|
||||
BOOST_REQUIRE(sst->get_stats_metadata().estimated_tombstone_drop_time.bin.size());
|
||||
check_min_max_column_names(sst, {}, {});
|
||||
}
|
||||
|
||||
{
|
||||
auto mt = make_lw_shared<replica::memtable>(s);
|
||||
mutation m(s, key);
|
||||
tombstone tomb(api::new_timestamp(), gc_clock::now());
|
||||
range_tombstone rt(
|
||||
@@ -1386,8 +1337,7 @@ SEASTAR_TEST_CASE(sstable_composite_tombstone_metadata_check) {
|
||||
clustering_key_prefix::from_exploded(*s, {to_bytes("z"), to_bytes("zz")}),
|
||||
tomb);
|
||||
m.partition().apply_delete(*s, std::move(rt));
|
||||
mt->apply(std::move(m));
|
||||
auto sst = make_sstable_containing(sst_gen, mt);
|
||||
auto sst = make_sstable_containing(sst_gen, {std::move(m)});
|
||||
BOOST_REQUIRE(sst->get_stats_metadata().estimated_tombstone_drop_time.bin.size());
|
||||
if (version >= sstable_version_types::mc) {
|
||||
check_min_max_column_names(sst, {"a", "aa"}, {"z", "zz"});
|
||||
@@ -1395,7 +1345,6 @@ SEASTAR_TEST_CASE(sstable_composite_tombstone_metadata_check) {
|
||||
}
|
||||
|
||||
{
|
||||
auto mt = make_lw_shared<replica::memtable>(s);
|
||||
mutation m(s, key);
|
||||
m.set_clustered_cell(c_key, r1_col, make_atomic_cell(int32_type, int32_type->decompose(1)));
|
||||
tombstone tomb(api::new_timestamp(), gc_clock::now());
|
||||
@@ -1404,8 +1353,7 @@ SEASTAR_TEST_CASE(sstable_composite_tombstone_metadata_check) {
|
||||
clustering_key_prefix::from_exploded(*s, {to_bytes("a"), to_bytes("zz")}),
|
||||
tomb);
|
||||
m.partition().apply_delete(*s, std::move(rt));
|
||||
mt->apply(std::move(m));
|
||||
auto sst = make_sstable_containing(sst_gen, mt);
|
||||
auto sst = make_sstable_containing(sst_gen, {std::move(m)});
|
||||
BOOST_REQUIRE(sst->get_stats_metadata().estimated_tombstone_drop_time.bin.size());
|
||||
if (version >= sstable_version_types::mc) {
|
||||
check_min_max_column_names(sst, {"a"}, {"c1", "c2"});
|
||||
@@ -1413,7 +1361,6 @@ SEASTAR_TEST_CASE(sstable_composite_tombstone_metadata_check) {
|
||||
}
|
||||
|
||||
{
|
||||
auto mt = make_lw_shared<replica::memtable>(s);
|
||||
mutation m(s, key);
|
||||
m.set_clustered_cell(c_key, r1_col, make_atomic_cell(int32_type, int32_type->decompose(1)));
|
||||
tombstone tomb(api::new_timestamp(), gc_clock::now());
|
||||
@@ -1422,8 +1369,7 @@ SEASTAR_TEST_CASE(sstable_composite_tombstone_metadata_check) {
|
||||
clustering_key_prefix::from_exploded(*s, {to_bytes("c1"), to_bytes("zz")}),
|
||||
tomb);
|
||||
m.partition().apply_delete(*s, std::move(rt));
|
||||
mt->apply(std::move(m));
|
||||
auto sst = make_sstable_containing(sst_gen, mt);
|
||||
auto sst = make_sstable_containing(sst_gen, {std::move(m)});
|
||||
BOOST_REQUIRE(sst->get_stats_metadata().estimated_tombstone_drop_time.bin.size());
|
||||
if (version >= sstable_version_types::mc) {
|
||||
check_min_max_column_names(sst, {"c1", "aa"}, {"c1", "zz"});
|
||||
@@ -1431,7 +1377,6 @@ SEASTAR_TEST_CASE(sstable_composite_tombstone_metadata_check) {
|
||||
}
|
||||
|
||||
{
|
||||
auto mt = make_lw_shared<replica::memtable>(s);
|
||||
mutation m(s, key);
|
||||
m.set_clustered_cell(c_key, r1_col, make_atomic_cell(int32_type, int32_type->decompose(1)));
|
||||
tombstone tomb(api::new_timestamp(), gc_clock::now());
|
||||
@@ -1440,8 +1385,7 @@ SEASTAR_TEST_CASE(sstable_composite_tombstone_metadata_check) {
|
||||
clustering_key_prefix::from_exploded(*s, {to_bytes("z"), to_bytes("zz")}),
|
||||
tomb);
|
||||
m.partition().apply_delete(*s, std::move(rt));
|
||||
mt->apply(std::move(m));
|
||||
auto sst = make_sstable_containing(sst_gen, mt);
|
||||
auto sst = make_sstable_containing(sst_gen, {std::move(m)});
|
||||
BOOST_REQUIRE(sst->get_stats_metadata().estimated_tombstone_drop_time.bin.size());
|
||||
if (version >= sstable_version_types::mc) {
|
||||
check_min_max_column_names(sst, {"c1", "c2"}, {"z", "zz"});
|
||||
@@ -1450,7 +1394,6 @@ SEASTAR_TEST_CASE(sstable_composite_tombstone_metadata_check) {
|
||||
|
||||
if (version >= sstable_version_types::mc) {
|
||||
{
|
||||
auto mt = make_lw_shared<replica::memtable>(s);
|
||||
mutation m(s, key);
|
||||
m.set_clustered_cell(c_key, r1_col, make_atomic_cell(int32_type, int32_type->decompose(1)));
|
||||
tombstone tomb(api::new_timestamp(), gc_clock::now());
|
||||
@@ -1459,14 +1402,12 @@ SEASTAR_TEST_CASE(sstable_composite_tombstone_metadata_check) {
|
||||
bound_view(clustering_key_prefix::from_single_value(*s, bytes("z")), bound_kind::incl_end),
|
||||
tomb);
|
||||
m.partition().apply_delete(*s, std::move(rt));
|
||||
mt->apply(std::move(m));
|
||||
auto sst = make_sstable_containing(sst_gen, mt);
|
||||
auto sst = make_sstable_containing(sst_gen, {std::move(m)});
|
||||
BOOST_REQUIRE(sst->get_stats_metadata().estimated_tombstone_drop_time.bin.size());
|
||||
check_min_max_column_names(sst, {}, {"z"});
|
||||
}
|
||||
|
||||
{
|
||||
auto mt = make_lw_shared<replica::memtable>(s);
|
||||
mutation m(s, key);
|
||||
m.set_clustered_cell(c_key, r1_col, make_atomic_cell(int32_type, int32_type->decompose(1)));
|
||||
tombstone tomb(api::new_timestamp(), gc_clock::now());
|
||||
@@ -1475,8 +1416,7 @@ SEASTAR_TEST_CASE(sstable_composite_tombstone_metadata_check) {
|
||||
bound_view::top(),
|
||||
tomb);
|
||||
m.partition().apply_delete(*s, std::move(rt));
|
||||
mt->apply(std::move(m));
|
||||
auto sst = make_sstable_containing(sst_gen, mt);
|
||||
auto sst = make_sstable_containing(sst_gen, {std::move(m)});
|
||||
BOOST_REQUIRE(sst->get_stats_metadata().estimated_tombstone_drop_time.bin.size());
|
||||
check_min_max_column_names(sst, {"a"}, {});
|
||||
}
|
||||
@@ -1502,67 +1442,54 @@ SEASTAR_TEST_CASE(sstable_composite_reverse_tombstone_metadata_check) {
|
||||
BOOST_TEST_MESSAGE(fmt::format("version {}", version));
|
||||
|
||||
{
|
||||
auto mt = make_lw_shared<replica::memtable>(s);
|
||||
mutation m(s, key);
|
||||
tombstone tomb(api::new_timestamp(), gc_clock::now());
|
||||
m.partition().apply_delete(*s, c_key, tomb);
|
||||
mt->apply(std::move(m));
|
||||
auto sst = make_sstable_containing(sst_gen, mt);
|
||||
auto sst = make_sstable_containing(sst_gen, {std::move(m)});
|
||||
BOOST_REQUIRE(sst->get_stats_metadata().estimated_tombstone_drop_time.bin.size());
|
||||
check_min_max_column_names(sst, {"c1", "c2"}, {"c1", "c2"});
|
||||
}
|
||||
|
||||
{
|
||||
auto mt = make_lw_shared<replica::memtable>(s);
|
||||
mutation m(s, key);
|
||||
m.set_clustered_cell(c_key, r1_col, make_dead_atomic_cell(3600));
|
||||
mt->apply(std::move(m));
|
||||
auto sst = make_sstable_containing(sst_gen, mt);
|
||||
auto sst = make_sstable_containing(sst_gen, {std::move(m)});
|
||||
BOOST_REQUIRE(sst->get_stats_metadata().estimated_tombstone_drop_time.bin.size());
|
||||
check_min_max_column_names(sst, {"c1", "c2"}, {"c1", "c2"});
|
||||
}
|
||||
|
||||
{
|
||||
auto mt = make_lw_shared<replica::memtable>(s);
|
||||
mutation m(s, key);
|
||||
m.set_clustered_cell(c_key, r1_col, make_atomic_cell(int32_type, int32_type->decompose(1)));
|
||||
mt->apply(std::move(m));
|
||||
auto sst = make_sstable_containing(sst_gen, mt);
|
||||
auto sst = make_sstable_containing(sst_gen, {std::move(m)});
|
||||
BOOST_REQUIRE(!sst->get_stats_metadata().estimated_tombstone_drop_time.bin.size());
|
||||
check_min_max_column_names(sst, {"c1", "c2"}, {"c1", "c2"});
|
||||
}
|
||||
|
||||
{
|
||||
auto mt = make_lw_shared<replica::memtable>(s);
|
||||
|
||||
mutation m(s, key);
|
||||
tombstone tomb(api::new_timestamp(), gc_clock::now());
|
||||
m.partition().apply_delete(*s, c_key, tomb);
|
||||
mt->apply(std::move(m));
|
||||
|
||||
auto key2 = partition_key::from_exploded(*s, {to_bytes("key2")});
|
||||
mutation m2(s, key2);
|
||||
m2.set_clustered_cell(c_key, r1_col, make_atomic_cell(int32_type, int32_type->decompose(1)));
|
||||
mt->apply(std::move(m2));
|
||||
|
||||
auto sst = make_sstable_containing(sst_gen, mt);
|
||||
auto sst = make_sstable_containing(sst_gen, {std::move(m), std::move(m2)});
|
||||
BOOST_REQUIRE(sst->get_stats_metadata().estimated_tombstone_drop_time.bin.size());
|
||||
check_min_max_column_names(sst, {"c1", "c2"}, {"c1", "c2"});
|
||||
}
|
||||
|
||||
{
|
||||
auto mt = make_lw_shared<replica::memtable>(s);
|
||||
mutation m(s, key);
|
||||
tombstone tomb(api::new_timestamp(), gc_clock::now());
|
||||
m.partition().apply(tomb);
|
||||
mt->apply(std::move(m));
|
||||
auto sst = make_sstable_containing(sst_gen, mt);
|
||||
auto sst = make_sstable_containing(sst_gen, {std::move(m)});
|
||||
BOOST_REQUIRE(sst->get_stats_metadata().estimated_tombstone_drop_time.bin.size());
|
||||
check_min_max_column_names(sst, {}, {});
|
||||
}
|
||||
|
||||
{
|
||||
auto mt = make_lw_shared<replica::memtable>(s);
|
||||
mutation m(s, key);
|
||||
tombstone tomb(api::new_timestamp(), gc_clock::now());
|
||||
range_tombstone rt(
|
||||
@@ -1570,8 +1497,7 @@ SEASTAR_TEST_CASE(sstable_composite_reverse_tombstone_metadata_check) {
|
||||
clustering_key_prefix::from_exploded(*s, {to_bytes("a"), to_bytes("aa")}),
|
||||
tomb);
|
||||
m.partition().apply_delete(*s, std::move(rt));
|
||||
mt->apply(std::move(m));
|
||||
auto sst = make_sstable_containing(sst_gen, mt);
|
||||
auto sst = make_sstable_containing(sst_gen, {std::move(m)});
|
||||
BOOST_REQUIRE(sst->get_stats_metadata().estimated_tombstone_drop_time.bin.size());
|
||||
if (version >= sstable_version_types::mc) {
|
||||
check_min_max_column_names(sst, {"a", "zz"}, {"a", "aa"});
|
||||
@@ -1579,7 +1505,6 @@ SEASTAR_TEST_CASE(sstable_composite_reverse_tombstone_metadata_check) {
|
||||
}
|
||||
|
||||
{
|
||||
auto mt = make_lw_shared<replica::memtable>(s);
|
||||
mutation m(s, key);
|
||||
m.set_clustered_cell(c_key, r1_col, make_atomic_cell(int32_type, int32_type->decompose(1)));
|
||||
tombstone tomb(api::new_timestamp(), gc_clock::now());
|
||||
@@ -1588,8 +1513,7 @@ SEASTAR_TEST_CASE(sstable_composite_reverse_tombstone_metadata_check) {
|
||||
clustering_key_prefix::from_exploded(*s, {to_bytes("a")}),
|
||||
tomb);
|
||||
m.partition().apply_delete(*s, std::move(rt));
|
||||
mt->apply(std::move(m));
|
||||
auto sst = make_sstable_containing(sst_gen, mt);
|
||||
auto sst = make_sstable_containing(sst_gen, {std::move(m)});
|
||||
BOOST_REQUIRE(sst->get_stats_metadata().estimated_tombstone_drop_time.bin.size());
|
||||
if (version >= sstable_version_types::mc) {
|
||||
check_min_max_column_names(sst, {"a", "zz"}, {"c1", "c2"});
|
||||
@@ -1597,7 +1521,6 @@ SEASTAR_TEST_CASE(sstable_composite_reverse_tombstone_metadata_check) {
|
||||
}
|
||||
|
||||
{
|
||||
auto mt = make_lw_shared<replica::memtable>(s);
|
||||
mutation m(s, key);
|
||||
m.set_clustered_cell(c_key, r1_col, make_atomic_cell(int32_type, int32_type->decompose(1)));
|
||||
tombstone tomb(api::new_timestamp(), gc_clock::now());
|
||||
@@ -1606,8 +1529,7 @@ SEASTAR_TEST_CASE(sstable_composite_reverse_tombstone_metadata_check) {
|
||||
clustering_key_prefix::from_exploded(*s, {to_bytes("c1")}),
|
||||
tomb);
|
||||
m.partition().apply_delete(*s, std::move(rt));
|
||||
mt->apply(std::move(m));
|
||||
auto sst = make_sstable_containing(sst_gen, mt);
|
||||
auto sst = make_sstable_containing(sst_gen, {std::move(m)});
|
||||
BOOST_REQUIRE(sst->get_stats_metadata().estimated_tombstone_drop_time.bin.size());
|
||||
if (version >= sstable_version_types::mc) {
|
||||
check_min_max_column_names(sst, {"c1", "zz"}, {"c1"});
|
||||
@@ -1615,7 +1537,6 @@ SEASTAR_TEST_CASE(sstable_composite_reverse_tombstone_metadata_check) {
|
||||
}
|
||||
|
||||
{
|
||||
auto mt = make_lw_shared<replica::memtable>(s);
|
||||
mutation m(s, key);
|
||||
m.set_clustered_cell(c_key, r1_col, make_atomic_cell(int32_type, int32_type->decompose(1)));
|
||||
tombstone tomb(api::new_timestamp(), gc_clock::now());
|
||||
@@ -1624,8 +1545,7 @@ SEASTAR_TEST_CASE(sstable_composite_reverse_tombstone_metadata_check) {
|
||||
clustering_key_prefix::from_exploded(*s, {to_bytes("c1"), to_bytes("d")}),
|
||||
tomb);
|
||||
m.partition().apply_delete(*s, std::move(rt));
|
||||
mt->apply(std::move(m));
|
||||
auto sst = make_sstable_containing(sst_gen, mt);
|
||||
auto sst = make_sstable_containing(sst_gen, {std::move(m)});
|
||||
BOOST_REQUIRE(sst->get_stats_metadata().estimated_tombstone_drop_time.bin.size());
|
||||
if (version >= sstable_version_types::mc) {
|
||||
check_min_max_column_names(sst, {"c1", "zz"}, {"c1", "c2"});
|
||||
@@ -1634,7 +1554,6 @@ SEASTAR_TEST_CASE(sstable_composite_reverse_tombstone_metadata_check) {
|
||||
|
||||
if (version >= sstable_version_types::mc) {
|
||||
{
|
||||
auto mt = make_lw_shared<replica::memtable>(s);
|
||||
mutation m(s, key);
|
||||
m.set_clustered_cell(c_key, r1_col, make_atomic_cell(int32_type, int32_type->decompose(1)));
|
||||
tombstone tomb(api::new_timestamp(), gc_clock::now());
|
||||
@@ -1643,14 +1562,12 @@ SEASTAR_TEST_CASE(sstable_composite_reverse_tombstone_metadata_check) {
|
||||
bound_view(clustering_key_prefix::from_single_value(*s, bytes("z")), bound_kind::incl_end),
|
||||
tomb);
|
||||
m.partition().apply_delete(*s, std::move(rt));
|
||||
mt->apply(std::move(m));
|
||||
auto sst = make_sstable_containing(sst_gen, mt);
|
||||
auto sst = make_sstable_containing(sst_gen, {std::move(m)});
|
||||
BOOST_REQUIRE(sst->get_stats_metadata().estimated_tombstone_drop_time.bin.size());
|
||||
check_min_max_column_names(sst, {}, {"z"});
|
||||
}
|
||||
|
||||
{
|
||||
auto mt = make_lw_shared<replica::memtable>(s);
|
||||
mutation m(s, key);
|
||||
m.set_clustered_cell(c_key, r1_col, make_atomic_cell(int32_type, int32_type->decompose(1)));
|
||||
tombstone tomb(api::new_timestamp(), gc_clock::now());
|
||||
@@ -1659,8 +1576,7 @@ SEASTAR_TEST_CASE(sstable_composite_reverse_tombstone_metadata_check) {
|
||||
bound_view::top(),
|
||||
tomb);
|
||||
m.partition().apply_delete(*s, std::move(rt));
|
||||
mt->apply(std::move(m));
|
||||
auto sst = make_sstable_containing(sst_gen, mt);
|
||||
auto sst = make_sstable_containing(sst_gen, {std::move(m)});
|
||||
BOOST_REQUIRE(sst->get_stats_metadata().estimated_tombstone_drop_time.bin.size());
|
||||
check_min_max_column_names(sst, {"a"}, {});
|
||||
}
|
||||
@@ -2856,8 +2772,6 @@ SEASTAR_TEST_CASE(sstable_reader_with_timeout) {
|
||||
return test_env::do_with_async([] (test_env& env) {
|
||||
auto s = complex_schema();
|
||||
|
||||
auto mt = make_lw_shared<replica::memtable>(s);
|
||||
|
||||
auto key = partition_key::from_exploded(*s, {to_bytes("key1")});
|
||||
auto cp = clustering_key_prefix::from_exploded(*s, {to_bytes("c1")});
|
||||
|
||||
@@ -2865,9 +2779,8 @@ SEASTAR_TEST_CASE(sstable_reader_with_timeout) {
|
||||
|
||||
tombstone tomb(api::new_timestamp(), gc_clock::now());
|
||||
m.partition().apply_delete(*s, cp, tomb);
|
||||
mt->apply(std::move(m));
|
||||
|
||||
auto sstp = make_sstable_containing(env.make_sstable(s), mt);
|
||||
auto sstp = make_sstable_containing(env.make_sstable(s), {std::move(m)});
|
||||
auto pr = dht::partition_range::make_singular(make_dkey(s, "key1"));
|
||||
auto timeout = db::timeout_clock::now();
|
||||
auto rd = sstp->make_reader(s, env.make_reader_permit(timeout), pr, s->full_slice());
|
||||
|
||||
@@ -391,16 +391,10 @@ SEASTAR_TEST_CASE(read_partial_range_2) {
|
||||
});
|
||||
}
|
||||
|
||||
static
|
||||
mutation_source make_sstable_mutation_source(sstables::test_env& env, schema_ptr s, sstring dir, std::vector<mutation> mutations,
|
||||
sstable_writer_config cfg, sstables::sstable::version_types version, gc_clock::time_point query_time = gc_clock::now()) {
|
||||
return as_mutation_source(make_sstable(env, s, dir, std::move(mutations), cfg, version, query_time));
|
||||
}
|
||||
|
||||
static
|
||||
mutation_source make_sstable_mutation_source(sstables::test_env& env, schema_ptr s, std::vector<mutation> mutations,
|
||||
sstable_writer_config cfg, sstables::sstable::version_types version, gc_clock::time_point query_time = gc_clock::now()) {
|
||||
return make_sstable_mutation_source(env, std::move(s), env.tempdir().path().native(), std::move(mutations), std::move(cfg), version, query_time);
|
||||
sstables::sstable::version_types version, gc_clock::time_point query_time = gc_clock::now()) {
|
||||
return as_mutation_source(make_sstable(env, s, std::move(mutations), env.manager().configure_writer(), version, query_time));
|
||||
}
|
||||
|
||||
SEASTAR_TEST_CASE(test_sstable_can_write_and_read_range_tombstone) {
|
||||
@@ -853,10 +847,7 @@ SEASTAR_TEST_CASE(test_non_compound_table_row_is_not_marked_as_static) {
|
||||
auto cell = atomic_cell::make_live(*int32_type, 1, int32_type->decompose(17), { });
|
||||
m.set_clustered_cell(ck, *s->get_column_definition("v"), std::move(cell));
|
||||
|
||||
auto mt = make_lw_shared<replica::memtable>(s);
|
||||
mt->apply(std::move(m));
|
||||
|
||||
auto sst = make_sstable_containing(env.make_sstable(s, version), mt);
|
||||
auto sst = make_sstable_containing(env.make_sstable(s, version), {std::move(m)});
|
||||
auto mut = with_closeable(sst->make_reader(s, env.make_reader_permit(), query::full_partition_range, s->full_slice()), [] (auto& mr) {
|
||||
return read_mutation_from_flat_mutation_reader(mr);
|
||||
}).get0();
|
||||
@@ -881,10 +872,7 @@ SEASTAR_TEST_CASE(test_has_partition_key) {
|
||||
auto cell = atomic_cell::make_live(*int32_type, 1, int32_type->decompose(17), { });
|
||||
m.set_clustered_cell(ck, *s->get_column_definition("v"), std::move(cell));
|
||||
|
||||
auto mt = make_lw_shared<replica::memtable>(s);
|
||||
mt->apply(std::move(m));
|
||||
|
||||
auto sst = make_sstable_containing(env.make_sstable(s, version), mt);
|
||||
auto sst = make_sstable_containing(env.make_sstable(s, version), {std::move(m)});
|
||||
auto hk = sstables::sstable::make_hashed_key(*s, dk.key());
|
||||
auto mr = sst->make_reader(s, env.make_reader_permit(), query::full_partition_range, s->full_slice());
|
||||
auto close_mr = deferred_close(mr);
|
||||
@@ -1251,7 +1239,7 @@ SEASTAR_TEST_CASE(test_no_index_reads_when_rows_fall_into_range_boundaries) {
|
||||
ss.add_row(m2, ss.make_ckey(5), "v");
|
||||
ss.add_row(m2, ss.make_ckey(6), "v");
|
||||
|
||||
auto ms = make_sstable_mutation_source(env, s, {m1, m2}, env.manager().configure_writer(), version);
|
||||
auto ms = make_sstable_mutation_source(env, s, {m1, m2}, version);
|
||||
|
||||
auto index_accesses = [] {
|
||||
auto&& stats = sstables::partition_index_cache::shard_stats();
|
||||
@@ -1583,8 +1571,7 @@ SEASTAR_TEST_CASE(test_static_compact_tables_are_read) {
|
||||
std::vector<mutation> muts = {m1, m2};
|
||||
boost::sort(muts, mutation_decorated_key_less_comparator{});
|
||||
|
||||
sstable_writer_config cfg = env.manager().configure_writer();
|
||||
auto ms = make_sstable_mutation_source(env, s, muts, cfg, version);
|
||||
auto ms = make_sstable_mutation_source(env, s, muts, version);
|
||||
|
||||
assert_that(ms.make_reader_v2(s, env.make_reader_permit()))
|
||||
.produces(muts[0])
|
||||
|
||||
@@ -25,6 +25,22 @@
|
||||
using namespace sstables;
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
lw_shared_ptr<replica::memtable> make_memtable(schema_ptr s, const std::vector<mutation>& muts) {
|
||||
auto mt = make_lw_shared<replica::memtable>(s);
|
||||
|
||||
std::size_t i{0};
|
||||
for (auto&& m : muts) {
|
||||
mt->apply(m);
|
||||
// Give the reactor some time to breathe
|
||||
if (++i == 10) {
|
||||
seastar::thread::yield();
|
||||
i = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return mt;
|
||||
}
|
||||
|
||||
sstables::shared_sstable make_sstable_containing(std::function<sstables::shared_sstable()> sst_factory, lw_shared_ptr<replica::memtable> mt) {
|
||||
return make_sstable_containing(sst_factory(), std::move(mt));
|
||||
}
|
||||
@@ -44,22 +60,7 @@ sstables::shared_sstable make_sstable_containing(sstables::shared_sstable sst, s
|
||||
tests::reader_concurrency_semaphore_wrapper semaphore;
|
||||
|
||||
schema_ptr s = muts[0].schema();
|
||||
auto mt = make_lw_shared<replica::memtable>(s);
|
||||
|
||||
std::size_t i{0};
|
||||
for (auto&& m : muts) {
|
||||
mt->apply(m);
|
||||
++i;
|
||||
|
||||
// Give the reactor some time to breathe
|
||||
if(i == 10) {
|
||||
seastar::thread::yield();
|
||||
i = 0;
|
||||
}
|
||||
}
|
||||
write_memtable_to_sstable_for_test(*mt, sst).get();
|
||||
sstable_open_config cfg { .load_first_and_last_position_metadata = true };
|
||||
sst->open_data(cfg).get();
|
||||
make_sstable_containing(sst, make_memtable(s, muts));
|
||||
|
||||
std::set<mutation, mutation_decorated_key_less_comparator> merged;
|
||||
for (auto&& m : muts) {
|
||||
@@ -85,13 +86,8 @@ sstables::shared_sstable make_sstable_containing(sstables::shared_sstable sst, s
|
||||
|
||||
shared_sstable make_sstable(sstables::test_env& env, schema_ptr s, sstring dir, std::vector<mutation> mutations,
|
||||
sstable_writer_config cfg, sstables::sstable::version_types version, gc_clock::time_point query_time) {
|
||||
auto mt = make_lw_shared<replica::memtable>(s);
|
||||
fs::path dir_path(dir);
|
||||
|
||||
for (auto&& m : mutations) {
|
||||
mt->apply(m);
|
||||
}
|
||||
|
||||
auto mt = make_memtable(s, mutations);
|
||||
auto sst = env.make_sstable(s, dir_path.string(), env.new_generation(), version, sstable_format_types::big, default_sstable_buffer_size, query_time);
|
||||
auto mr = mt->make_flat_reader(s, env.make_reader_permit());
|
||||
sst->write_components(std::move(mr), mutations.size(), s, cfg, mt->get_encoding_stats()).get();
|
||||
@@ -100,9 +96,9 @@ shared_sstable make_sstable(sstables::test_env& env, schema_ptr s, sstring dir,
|
||||
}
|
||||
|
||||
shared_sstable make_sstable_easy(test_env& env, flat_mutation_reader_v2 rd, sstable_writer_config cfg,
|
||||
sstables::generation_type gen, const sstables::sstable::version_types version, int expected_partition) {
|
||||
sstables::generation_type gen, const sstables::sstable::version_types version, int expected_partition, gc_clock::time_point query_time) {
|
||||
auto s = rd.schema();
|
||||
auto sst = env.make_sstable(s, gen, version, sstable_format_types::big);
|
||||
auto sst = env.make_sstable(s, gen, version, sstable_format_types::big, default_sstable_buffer_size, query_time);
|
||||
sst->write_components(std::move(rd), expected_partition, s, cfg, encoding_stats{}).get();
|
||||
sst->load().get();
|
||||
return sst;
|
||||
@@ -110,12 +106,7 @@ shared_sstable make_sstable_easy(test_env& env, flat_mutation_reader_v2 rd, ssta
|
||||
|
||||
shared_sstable make_sstable_easy(test_env& env, lw_shared_ptr<replica::memtable> mt, sstable_writer_config cfg,
|
||||
sstables::generation_type gen, const sstable::version_types v, int estimated_partitions, gc_clock::time_point query_time) {
|
||||
schema_ptr s = mt->schema();
|
||||
auto sst = env.make_sstable(s, gen, v, sstable_format_types::big, default_sstable_buffer_size, query_time);
|
||||
auto mr = mt->make_flat_reader(s, env.make_reader_permit());
|
||||
sst->write_components(std::move(mr), estimated_partitions, s, cfg, mt->get_encoding_stats()).get();
|
||||
sst->load().get();
|
||||
return sst;
|
||||
return make_sstable_easy(env, mt->make_flat_reader(mt->schema(), env.make_reader_permit()), std::move(cfg), gen, v, estimated_partitions, query_time);
|
||||
}
|
||||
|
||||
future<compaction_result> compact_sstables(compaction_manager& cm, sstables::compaction_descriptor descriptor, table_state& table_s, std::function<shared_sstable()> creator, compaction_sstable_replacer_fn replacer,
|
||||
|
||||
@@ -289,7 +289,7 @@ future<compaction_result> compact_sstables(compaction_manager& cm, sstables::com
|
||||
can_purge_tombstones can_purge = can_purge_tombstones::yes);
|
||||
|
||||
shared_sstable make_sstable_easy(test_env& env, flat_mutation_reader_v2 rd, sstable_writer_config cfg,
|
||||
sstables::generation_type gen, const sstables::sstable::version_types version = sstables::get_highest_sstable_version(), int expected_partition = 1);
|
||||
sstables::generation_type gen, const sstables::sstable::version_types version = sstables::get_highest_sstable_version(), int expected_partition = 1, gc_clock::time_point = gc_clock::now());
|
||||
shared_sstable make_sstable_easy(test_env& env, lw_shared_ptr<replica::memtable> mt, sstable_writer_config cfg,
|
||||
sstables::generation_type gen, const sstable::version_types v = sstables::get_highest_sstable_version(), int estimated_partitions = 1, gc_clock::time_point = gc_clock::now());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user