mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-12 19:02:12 +00:00
Merge 'Fix mutation commutativity with shadowable tombstone'
from Tomasz Grabiec This series fixes lack of mutation associativity which manifests as sporadic failures in row_cache_test.cc::test_concurrent_reads_and_eviction due to differences in mutations applied and read. No known production impact. Refs https://github.com/scylladb/scylladb/issues/11307 Closes #11312 * github.com:scylladb/scylladb: test: mutation_test: Add explicit test for mutation commutativity test: random_mutation_generator: Workaround for non-associativity of mutations with shadowable tombstones db: mutation_partition: Drop unnecessary maybe_shadow() db: mutation_partition: Maintain shadowable tombstone invariant when applying a hard tombstone mutation_partition: row: make row marker shadowing symmetric
This commit is contained in:
@@ -826,6 +826,7 @@ public:
|
||||
|
||||
void apply(tombstone deleted_at) {
|
||||
_deleted_at.apply(deleted_at);
|
||||
maybe_shadow();
|
||||
}
|
||||
|
||||
void apply(shadowable_tombstone deleted_at) {
|
||||
|
||||
@@ -1852,6 +1852,29 @@ SEASTAR_TEST_CASE(test_continuity_merging_of_complete_mutations) {
|
||||
return make_ready_future<>();
|
||||
}
|
||||
|
||||
SEASTAR_TEST_CASE(test_commutativity_and_associativity) {
|
||||
random_mutation_generator gen(random_mutation_generator::generate_counters::no);
|
||||
gen.set_key_cardinality(7);
|
||||
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
mutation m1 = gen();
|
||||
m1.partition().make_fully_continuous();
|
||||
mutation m2 = gen();
|
||||
m2.partition().make_fully_continuous();
|
||||
mutation m3 = gen();
|
||||
m3.partition().make_fully_continuous();
|
||||
|
||||
assert_that(m1 + m2 + m3)
|
||||
.is_equal_to(m1 + m3 + m2)
|
||||
.is_equal_to(m2 + m1 + m3)
|
||||
.is_equal_to(m2 + m3 + m1)
|
||||
.is_equal_to(m3 + m1 + m2)
|
||||
.is_equal_to(m3 + m2 + m1);
|
||||
}
|
||||
|
||||
return make_ready_future<>();
|
||||
}
|
||||
|
||||
SEASTAR_TEST_CASE(test_continuity_merging) {
|
||||
return seastar::async([] {
|
||||
simple_schema table;
|
||||
|
||||
@@ -2247,6 +2247,11 @@ public:
|
||||
if (_not_dummy_dist(_gen)) {
|
||||
deletable_row& row = m.partition().clustered_row(*_schema, ckey, is_dummy::no, continuous);
|
||||
row.apply(random_row_marker());
|
||||
if (!row.marker().is_missing() && !row.marker().is_live()) {
|
||||
// Mutations are not associative if dead marker is not matched with a dead row
|
||||
// due to shadowable tombstone merging rules. See #11307.
|
||||
row.apply(tombstone(row.marker().timestamp(), row.marker().deletion_time()));
|
||||
}
|
||||
if (_bool_dist(_gen)) {
|
||||
set_random_cells(row.cells(), column_kind::regular_column);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user