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
main
Islam AbdelRahman 9 years ago
parent b345b36620
commit 19ef3de57e
  1. 6
      db/db_compaction_test.cc

@ -986,7 +986,9 @@ TEST_P(DBCompactionTestWithParam, ManualCompactionPartial) {
bool second = true; bool second = true;
rocksdb::SyncPoint::GetInstance()->LoadDependency( rocksdb::SyncPoint::GetInstance()->LoadDependency(
{{"DBCompaction::ManualPartial:4", "DBCompaction::ManualPartial:1"}, {{"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( rocksdb::SyncPoint::GetInstance()->SetCallBack(
"DBImpl::BackgroundCompaction:NonTrivial:AfterRun", [&](void* arg) { "DBImpl::BackgroundCompaction:NonTrivial:AfterRun", [&](void* arg) {
if (first) { if (first) {
@ -1097,6 +1099,8 @@ TEST_P(DBCompactionTestWithParam, ManualCompactionPartial) {
// 3 files in L0 // 3 files in L0
ASSERT_EQ("3,0,0,0,0,1,2", FilesPerLevel(0)); 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 // 1 file in L6, 1 file in L1
dbfull()->TEST_WaitForFlushMemTable(); dbfull()->TEST_WaitForFlushMemTable();
dbfull()->TEST_WaitForCompact(); dbfull()->TEST_WaitForCompact();

Loading…
Cancel
Save