From 67036c0406a53fa04213399bd323555cb710e51f Mon Sep 17 00:00:00 2001 From: sdong Date: Tue, 6 Sep 2016 12:57:46 -0700 Subject: [PATCH] Fix Flaky ColumnFamilyTest.FlushCloseWALFiles Summary: In ColumnFamilyTest.FlushCloseWALFiles, there is a small window in which the flush has finished but the log writer is not yet closed, causing the assert failure. Fix it by explicitly waiting the flush job to finish. Test Plan: Run the test many times in high parallelism. Subscribers: leveldb, andrewkr, dhruba Differential Revision: https://reviews.facebook.net/D63423 --- db/column_family_test.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/db/column_family_test.cc b/db/column_family_test.cc index e088c9c78..b4e11867d 100644 --- a/db/column_family_test.cc +++ b/db/column_family_test.cc @@ -2851,6 +2851,11 @@ TEST_F(ColumnFamilyTest, FlushCloseWALFiles) { ASSERT_OK(Put(0, "fodor", "mirko")); ASSERT_OK(Put(1, "fodor", "mirko")); + rocksdb::SyncPoint::GetInstance()->LoadDependency({ + {"DBImpl::BGWorkFlush:done", "FlushCloseWALFiles:0"}, + }); + rocksdb::SyncPoint::GetInstance()->EnableProcessing(); + // Block flush jobs from running test::SleepingBackgroundTask sleeping_task; env_->Schedule(&test::SleepingBackgroundTask::DoSleepTask, &sleeping_task, @@ -2864,7 +2869,8 @@ TEST_F(ColumnFamilyTest, FlushCloseWALFiles) { sleeping_task.WakeUp(); sleeping_task.WaitUntilDone(); - WaitForFlush(1); + TEST_SYNC_POINT("FlushCloseWALFiles:0"); + rocksdb::SyncPoint::GetInstance()->DisableProcessing(); ASSERT_EQ(1, env.num_open_wal_file_.load()); Reopen();