Skip to content

Commit

Permalink
fix flaky DBSSTTest.DeleteSchedulerMultipleDBPaths
Browse files Browse the repository at this point in the history
Summary:
I landed facebook#3544 which made this test flaky. The reason was the files scheduled for deletion sometimes went through the trash-marking process, and sometimes were deleted directly. Our counter only bumped on the former code path, so if the latter code path was used, we'd miss counting a file deleted by deletion scheduler. This PR also bumps the counter in the latter code path.
Closes facebook#3593

Differential Revision: D7226173

Pulled By: yiwu-arbug

fbshipit-source-id: 81ab44c60834df6ff88db1d73ea34e26c6e93c39
  • Loading branch information
ajkr authored and facebook-github-bot committed Mar 13, 2018
1 parent 7153153 commit 2256dab
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions db/db_sst_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,11 @@ TEST_F(DBSSTTest, DeleteSchedulerMultipleDBPaths) {
rocksdb::SyncPoint::GetInstance()->SetCallBack(
"DeleteScheduler::DeleteTrashFile:DeleteFile",
[&](void* arg) { bg_delete_file++; });
// The deletion scheduler sometimes skips marking file as trash according to
// a heuristic. In that case the deletion will go through the below SyncPoint.
rocksdb::SyncPoint::GetInstance()->SetCallBack(
"DeleteScheduler::DeleteFile",
[&](void* arg) { bg_delete_file++; });
rocksdb::SyncPoint::GetInstance()->EnableProcessing();

Options options = CurrentOptions();
Expand Down Expand Up @@ -461,15 +466,15 @@ TEST_F(DBSSTTest, DeleteSchedulerMultipleDBPaths) {
sfm->WaitForEmptyTrash();
ASSERT_EQ(bg_delete_file, 8);

// Compaction will delete and regenerate a file from L1 in second db path. It
// should still be cleaned up via delete scheduler.
// Compaction will delete both files and regenerate a file in L1 in second
// db path. The deleted files should still be cleaned up via delete scheduler.
compact_options.bottommost_level_compaction =
BottommostLevelCompaction::kForce;
ASSERT_OK(db_->CompactRange(compact_options, nullptr, nullptr));
ASSERT_EQ("0,1", FilesPerLevel(0));

sfm->WaitForEmptyTrash();
ASSERT_EQ(bg_delete_file, 9);
ASSERT_EQ(bg_delete_file, 10);

rocksdb::SyncPoint::GetInstance()->DisableProcessing();
}
Expand Down

0 comments on commit 2256dab

Please sign in to comment.