From 19ef3de57e3a47a47f155d52dfbafaf2bcbf79b4 Mon Sep 17 00:00:00 2001 From: Islam AbdelRahman Date: Wed, 13 Apr 2016 10:38:45 -0700 Subject: [PATCH] Fix ManualCompactionPartial test flakiness Summary: The reason for this test flakiness is that we try to verify that number of files in L0 is 3 after flushing the 3rd file although we may have a compaction running in the background that may finish before we do the check and the 3 L0 files are converted to 1 L1 file Test Plan: Run a modified version of the test that sleep before doing the check Reviewers: sdong, andrewkr, kradhakrishnan, yhchiang Reviewed By: yhchiang Subscribers: andrewkr, dhruba Differential Revision: https://reviews.facebook.net/D56643 --- db/db_compaction_test.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/db/db_compaction_test.cc b/db/db_compaction_test.cc index 2d1ee205f..677cacb22 100644 --- a/db/db_compaction_test.cc +++ b/db/db_compaction_test.cc @@ -986,7 +986,9 @@ TEST_P(DBCompactionTestWithParam, ManualCompactionPartial) { bool second = true; rocksdb::SyncPoint::GetInstance()->LoadDependency( {{"DBCompaction::ManualPartial:4", "DBCompaction::ManualPartial:1"}, - {"DBCompaction::ManualPartial:2", "DBCompaction::ManualPartial:3"}}); + {"DBCompaction::ManualPartial:2", "DBCompaction::ManualPartial:3"}, + {"DBCompaction::ManualPartial:5", + "DBImpl::BackgroundCompaction:NonTrivial:AfterRun"}}); rocksdb::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:NonTrivial:AfterRun", [&](void* arg) { if (first) { @@ -1097,6 +1099,8 @@ TEST_P(DBCompactionTestWithParam, ManualCompactionPartial) { // 3 files in L0 ASSERT_EQ("3,0,0,0,0,1,2", FilesPerLevel(0)); + TEST_SYNC_POINT("DBCompaction::ManualPartial:5"); + // 1 file in L6, 1 file in L1 dbfull()->TEST_WaitForFlushMemTable(); dbfull()->TEST_WaitForCompact();