From 7882cb9773a89f7fc707c69a2ac55e98bb9f39bd Mon Sep 17 00:00:00 2001 From: Yi Wu Date: Fri, 5 Aug 2016 16:45:57 -0700 Subject: [PATCH] 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 --- db/db_options_test.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/db/db_options_test.cc b/db/db_options_test.cc index 0d484d79f..da65a5b67 100644 --- a/db/db_options_test.cc +++ b/db/db_options_test.cc @@ -30,7 +30,7 @@ TEST_F(DBOptionsTest, EnableAutoCompactionAndTriggerStall) { Options options; options.create_if_missing = true; options.disable_auto_compactions = true; - options.write_buffer_size = 1024 * 1024; + options.write_buffer_size = 1024 * 1024 * 10; options.compression = CompressionType::kNoCompression; options.level0_file_num_compaction_trigger = 1; options.level0_stop_writes_trigger = std::numeric_limits::max(); @@ -41,9 +41,15 @@ TEST_F(DBOptionsTest, EnableAutoCompactionAndTriggerStall) { std::numeric_limits::max(); DestroyAndReopen(options); - for (int i = 0; i < 1024 * 2; i++) { + int i = 0; + for (; i < 1024; i++) { Put(Key(i), kValue); } + Flush(); + for (; i < 1024 * 2; i++) { + Put(Key(i), kValue); + } + Flush(); dbfull()->TEST_WaitForFlushMemTable(); ASSERT_EQ(2, NumTableFilesAtLevel(0)); uint64_t l0_size = SizeAtLevel(0);