From 8f4f302316017fd89a2dbf4f965b797b8a85210e Mon Sep 17 00:00:00 2001 From: Yanqin Jin Date: Sun, 31 Oct 2021 22:06:04 -0700 Subject: [PATCH] Attempt to deflake DBFlushTest.FireOnFlushCompletedAfterCommittedResult (#9083) Summary: DBFlushTest.FireOnFlushCompletedAfterCommittedResult uses test sync points to coordinate interleaving of different threads. Before this PR, the test writes some data to memtable, triggers a manual flush, and triggers a second manual flush after a first bg flush thread starts executing. Though unlikely, it is possible for the second bg flush thread to run faster than the first bg flush thread and deques flush queue first. In this case, the original test will fail. The fix is to wait until the first bg flush thread deques the flush queue before triggering second manual flush. Pull Request resolved: https://github.com/facebook/rocksdb/pull/9083 Test Plan: ./db_flush_test --gtest_filter=DBFlushTest.FireOnFlushCompletedAfterCommittedResult Reviewed By: jay-zhuang Differential Revision: D31951239 Pulled By: riversand963 fbshipit-source-id: f32d7cdabe6ad6808fd18e54e663936dc0a9edb4 --- db/db_flush_test.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/db_flush_test.cc b/db/db_flush_test.cc index fc9725516..9fe4cf2b2 100644 --- a/db/db_flush_test.cc +++ b/db/db_flush_test.cc @@ -1534,7 +1534,7 @@ TEST_F(DBFlushTest, FireOnFlushCompletedAfterCommittedResult) { std::shared_ptr listener = std::make_shared(); SyncPoint::GetInstance()->LoadDependency( - {{"DBImpl::BackgroundCallFlush:start", + {{"DBImpl::FlushMemTableToOutputFile:AfterPickMemtables", "DBFlushTest::FireOnFlushCompletedAfterCommittedResult:WaitFirst"}, {"DBImpl::FlushMemTableToOutputFile:Finish", "DBFlushTest::FireOnFlushCompletedAfterCommittedResult:WaitSecond"}});