Fix flaky DBSSTTEST::DeleteObsoleteFilesPendingOutputs

Summary: The test is flaky on Travis in osx environment. The background flush the test wanting to block can run behind the L2 manual compaction, making the test actually blocking the L2 compaction and won't able to proceed.

Test Plan: Test run on travis

Reviewers: kradhakrishnan, sdong, andrewkr, IslamAbdelRahman

Reviewed By: IslamAbdelRahman

Subscribers: andrewkr, dhruba, leveldb

Differential Revision: https://reviews.facebook.net/D61101
This commit is contained in:
Yi Wu 2016-07-25 15:09:34 -07:00
parent b2a8016df1
commit ae0ad719de

View file

@ -145,12 +145,13 @@ TEST_F(DBSSTTest, DeleteObsoleteFilesPendingOutputs) {
} }
}; };
env_->table_write_callback_ = &block_first_time; env_->table_write_callback_ = &block_first_time;
// Create 1MB sst file // Insert 2.5MB data, which should trigger a flush because we exceed
// write_buffer_size. The flush will be blocked with block_first_time
// pending_file is protecting all the files created after
for (int j = 0; j < 256; ++j) { for (int j = 0; j < 256; ++j) {
ASSERT_OK(Put(Key(j), RandomString(&rnd, 10 * 1024))); ASSERT_OK(Put(Key(j), RandomString(&rnd, 10 * 1024)));
} }
// this should trigger a flush, which is blocked with block_first_time blocking_thread.WaitUntilSleeping();
// pending_file is protecting all the files created after
ASSERT_OK(dbfull()->TEST_CompactRange(2, nullptr, nullptr)); ASSERT_OK(dbfull()->TEST_CompactRange(2, nullptr, nullptr));