From 3bec1cc19fd12717bc8a09ba5bc2d3b40bb57e07 Mon Sep 17 00:00:00 2001 From: Tomasz Grabiec Date: Sun, 29 May 2022 18:32:32 +0200 Subject: [PATCH] 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 0e78ad50ea52f3aecb6380527da4152eeab0881e) Closes #10802 --- test/boost/memtable_test.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/test/boost/memtable_test.cc b/test/boost/memtable_test.cc index 7b97c581ab..3345caed8c 100644 --- a/test/boost/memtable_test.cc +++ b/test/boost/memtable_test.cc @@ -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);