Fix flaky test DeleteFileRange (#4784)

Summary:
The test fails sporadically expecting the DB to be empty after DeleteFilesInRange(..., nullptr, nullptr) call which is not. Debugging shows cases where the files are skipped since they are being compacted. The patch fixes the test by waiting for the last CompactRange to finish before calling DeleteFilesInRange.
Verified by
```
~/gtest-parallel/gtest-parallel ./db_compaction_test --gtest_filter=DBCompactionTest.DeleteFileRange --repeat=10000
```
Pull Request resolved: https://github.com/facebook/rocksdb/pull/4784

Differential Revision: D13469402

Pulled By: maysamyabandeh

fbshipit-source-id: 3d8f44abe205b82c69f01e7edf27e1f8098248e1
main
Maysam Yabandeh 6 years ago committed by Facebook Github Bot
parent d6dfe516ff
commit 4ed3c1eb88
  1. 1
      db/db_compaction_test.cc

@ -1597,6 +1597,7 @@ TEST_F(DBCompactionTest, DeleteFileRange) {
compact_options.change_level = true;
compact_options.target_level = 1;
ASSERT_OK(db_->CompactRange(compact_options, nullptr, nullptr));
dbfull()->TEST_WaitForCompact();
ASSERT_OK(
DeleteFilesInRange(db_, db_->DefaultColumnFamily(), nullptr, nullptr));

Loading…
Cancel
Save