Skip to content

Commit

Permalink
test: view_build_test: add range tombstones to test_view_update_gener…
Browse files Browse the repository at this point in the history
…ator_buffering

This patch adds a full-range tombstone to the compacted mutation.
This raises the coverage of the test. In particular, it reproduces
issue scylladb#14503, which should have been caught by this test, but wasn't.
  • Loading branch information
michoecho committed Jul 11, 2023
1 parent b3f1789 commit 9d58719
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions test/boost/view_build_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -732,23 +732,25 @@ SEASTAR_THREAD_TEST_CASE(test_view_update_generator_buffering) {
total_rows,
_buffer_rows);

BOOST_REQUIRE(current_rows);
BOOST_REQUIRE(!mut.partition().empty());
BOOST_REQUIRE(current_rows <= _max_rows_hard);
BOOST_REQUIRE(_buffer_rows <= _max_rows_hard);

// The current partition doesn't have all of its rows yet, verify
// that the new mutation contains the next rows for the same
// partition
if (!_collected_muts.empty() && rows_in_mut(_collected_muts.back()) < _partition_rows.at(_collected_muts.back().decorated_key())) {
BOOST_REQUIRE(_collected_muts.back().decorated_key().equal(*mut.schema(), mut.decorated_key()));
const auto& previous_ckey = (--_collected_muts.back().partition().clustered_rows().end())->key();
const auto& next_ckey = mut.partition().clustered_rows().begin()->key();
BOOST_REQUIRE(_less_cmp(previous_ckey, next_ckey));
if (!_collected_muts.empty() && _collected_muts.back().decorated_key().equal(*mut.schema(), mut.decorated_key())) {
if (rows_in_mut(_collected_muts.back()) && rows_in_mut(mut)) {
const auto& previous_ckey = (--_collected_muts.back().partition().clustered_rows().end())->key();
const auto& next_ckey = mut.partition().clustered_rows().begin()->key();
BOOST_REQUIRE(_less_cmp(previous_ckey, next_ckey));
}
mutation_application_stats stats;
_collected_muts.back().partition().apply(*_schema, mut.partition(), *mut.schema(), stats);
// The new mutation is a new partition.
} else {
if (!_collected_muts.empty()) {
BOOST_REQUIRE(rows_in_mut(_collected_muts.back()) == _partition_rows.at(_collected_muts.back().decorated_key()));
BOOST_REQUIRE(!_collected_muts.back().decorated_key().equal(*mut.schema(), mut.decorated_key()));
}
_collected_muts.push_back(std::move(mut));
Expand Down Expand Up @@ -817,6 +819,8 @@ SEASTAR_THREAD_TEST_CASE(test_view_update_generator_buffering) {
for (auto ck = 0; ck < partition_size_100kb; ++ck) {
mut_desc.add_clustered_cell({int32_type->decompose(data_value(ck))}, "v", tests::data_model::mutation_description::value(blob_100kb));
}
// Reproduces #14503
mut_desc.add_range_tombstone(nonwrapping_range<tests::data_model::mutation_description::key>::make_open_ended_both_sides());
muts.push_back(mut_desc.build(schema));
partition_rows.emplace(muts.back().decorated_key(), partition_size_100kb);
}
Expand Down

0 comments on commit 9d58719

Please sign in to comment.