Make DBOptionsTest::EnableAutoCompactionAndTriggerStall less falky

Summary: Explicitly flush two times to generate two sst files.

Test Plan: run the test.

Reviewers: sdong

Reviewed By: sdong

Subscribers: andrewkr, dhruba, leveldb

Differential Revision: https://reviews.facebook.net/D61671
This commit is contained in:
Yi Wu 2016-08-05 16:45:57 -07:00
parent 44f5cc57a5
commit 7882cb9773

View File

@ -30,7 +30,7 @@ TEST_F(DBOptionsTest, EnableAutoCompactionAndTriggerStall) {
Options options; Options options;
options.create_if_missing = true; options.create_if_missing = true;
options.disable_auto_compactions = true; options.disable_auto_compactions = true;
options.write_buffer_size = 1024 * 1024; options.write_buffer_size = 1024 * 1024 * 10;
options.compression = CompressionType::kNoCompression; options.compression = CompressionType::kNoCompression;
options.level0_file_num_compaction_trigger = 1; options.level0_file_num_compaction_trigger = 1;
options.level0_stop_writes_trigger = std::numeric_limits<int>::max(); options.level0_stop_writes_trigger = std::numeric_limits<int>::max();
@ -41,9 +41,15 @@ TEST_F(DBOptionsTest, EnableAutoCompactionAndTriggerStall) {
std::numeric_limits<uint64_t>::max(); std::numeric_limits<uint64_t>::max();
DestroyAndReopen(options); DestroyAndReopen(options);
for (int i = 0; i < 1024 * 2; i++) { int i = 0;
for (; i < 1024; i++) {
Put(Key(i), kValue); Put(Key(i), kValue);
} }
Flush();
for (; i < 1024 * 2; i++) {
Put(Key(i), kValue);
}
Flush();
dbfull()->TEST_WaitForFlushMemTable(); dbfull()->TEST_WaitForFlushMemTable();
ASSERT_EQ(2, NumTableFilesAtLevel(0)); ASSERT_EQ(2, NumTableFilesAtLevel(0));
uint64_t l0_size = SizeAtLevel(0); uint64_t l0_size = SizeAtLevel(0);