From 2a282e5f545d4a456e26e8e631a957b280fe5b0a Mon Sep 17 00:00:00 2001 From: sdong Date: Fri, 15 Jul 2016 10:51:59 -0700 Subject: [PATCH] DBTablePropertiesTest.GetPropertiesOfTablesInRange: Fix Flaky Summary: Summary There is a possibility that there is no L0 file after writing the data. Generate an L0 file to make it work. Test Plan: Run the test many times. Reviewers: andrewkr, yiwu Reviewed By: yiwu Subscribers: leveldb, andrewkr, dhruba Differential Revision: https://reviews.facebook.net/D60825 --- db/db_table_properties_test.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/db/db_table_properties_test.cc b/db/db_table_properties_test.cc index 4501eb4dc..de2ace0d2 100644 --- a/db/db_table_properties_test.cc +++ b/db/db_table_properties_test.cc @@ -138,14 +138,14 @@ TEST_F(DBTablePropertiesTest, GetPropertiesOfTablesInRange) { Options options; options.create_if_missing = true; options.write_buffer_size = 4096; - options.max_write_buffer_number = 8; + options.max_write_buffer_number = 3; options.level0_file_num_compaction_trigger = 2; options.level0_slowdown_writes_trigger = 2; options.level0_stop_writes_trigger = 4; options.target_file_size_base = 2048; options.max_bytes_for_level_base = 10240; options.max_bytes_for_level_multiplier = 4; - options.soft_rate_limit = 1.1; + options.hard_pending_compaction_bytes_limit = 16 * 1024; options.num_levels = 8; DestroyAndReopen(options); @@ -155,6 +155,12 @@ TEST_F(DBTablePropertiesTest, GetPropertiesOfTablesInRange) { ASSERT_OK(Put(test::RandomKey(&rnd, 5), RandomString(&rnd, 102))); } Flush(); + dbfull()->TEST_WaitForCompact(); + if (NumTableFilesAtLevel(0) == 0) { + ASSERT_OK(Put(test::RandomKey(&rnd, 5), RandomString(&rnd, 102))); + Flush(); + } + db_->PauseBackgroundWork(); // Ensure that we have at least L0, L1 and L2