test: memtable: Make failed_flush_prevents_writes() immune to background merging

Before the change, the test artificiallu set the soft pressure
condition hoping that the background flusher will flush the
memtable. It won't happen if by the time the background flusher runs
the LSA region is updated and soft pressure (which is not really
there) is lifted. Once apply() becomes preemptibe, backgroun partition
version merging can lift the soft pressure, making the memtable flush
not occur and making the test fail.

Fix by triggering soft pressure on retries.

Fixes #10801
Refs #10793

(cherry picked from commit 0e78ad50ea)

Closes #10802
This commit is contained in:
Tomasz Grabiec
2022-05-29 18:32:32 +02:00
parent db5b05948b
commit 3bec1cc19f

View File

@@ -794,10 +794,11 @@ SEASTAR_TEST_CASE(failed_flush_prevents_writes) {
utils::get_local_injector().enable("table_seal_active_memtable_pre_flush");
// Trigger flush
dmm.notify_soft_pressure();
BOOST_ASSERT(eventually_true([&db]() { return db.cf_stats()->failed_memtables_flushes_count != 0; }));
BOOST_ASSERT(eventually_true([&] {
// Trigger flush
dmm.notify_soft_pressure();
return db.cf_stats()->failed_memtables_flushes_count != 0;
}));
// The flush failed, make sure there is still data in memtable.
BOOST_ASSERT(t.min_memtable_timestamp() < api::max_timestamp);