diff --git a/db/db_log_iter_test.cc b/db/db_log_iter_test.cc index 41f5fe4d15..dcfa32f5b6 100644 --- a/db/db_log_iter_test.cc +++ b/db/db_log_iter_test.cc @@ -14,6 +14,7 @@ #include "db/db_test_util.h" #include "env/mock_env.h" #include "port/stack_trace.h" +#include "util/atomic.h" namespace ROCKSDB_NAMESPACE { @@ -147,6 +148,7 @@ TEST_F(DBTestXactLogIterator, TransactionLogIteratorRace) { } TEST_F(DBTestXactLogIterator, TransactionLogIteratorCheckWhenArchive) { + RelaxedAtomic callback_hit{}; do { ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->ClearTrace(); Options options = OptionsForLogIterTest(); @@ -168,17 +170,22 @@ TEST_F(DBTestXactLogIterator, TransactionLogIteratorCheckWhenArchive) { ASSERT_OK(dbfull()->Put(WriteOptions(), "key4", DummyString(1024))); ASSERT_OK(dbfull()->Flush(FlushOptions())); + callback_hit.StoreRelaxed(false); ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "WalManager::PurgeObsoleteFiles:1", [&](void*) { auto iter = OpenTransactionLogIter(0); ExpectRecords(4, iter); + callback_hit.StoreRelaxed(true); }); ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); ASSERT_OK(dbfull()->Flush(FlushOptions(), cf)); - delete cf; + // Normally hit several times; WART: perhaps more in parallel after flush + ASSERT_TRUE(callback_hit.LoadRelaxed()); } while (ChangeCompactOptions()); + Close(); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); } #endif