From e61d9c1484c32bd0028604ef65a724f7f55f2447 Mon Sep 17 00:00:00 2001 From: sdong Date: Thu, 8 Oct 2015 18:00:47 -0700 Subject: [PATCH] Make DBTest.AggregatedTableProperties more deterministic Summary: Now based on environment, DBTest.AggregatedTableProperties has a possibility of issuing a L0->L1 compaction after reopening and the results are not what we expected. We tune the L0 compaction trigger to make it less likely to happen. Test Plan: I can't repro the failure but I think the change is better. Just run the test and make sure it passes. Reviewers: kradhakrishnan, yhchiang, igor Reviewed By: igor Subscribers: leveldb, dhruba Differential Revision: https://reviews.facebook.net/D48423 --- db/db_test.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/db/db_test.cc b/db/db_test.cc index 35a0b6755..0f9d43ce0 100644 --- a/db/db_test.cc +++ b/db/db_test.cc @@ -642,10 +642,10 @@ TEST_F(DBTest, AggregatedTableProperties) { TEST_F(DBTest, ReadLatencyHistogramByLevel) { Options options = CurrentOptions(); options.write_buffer_size = 110 << 10; - options.level0_file_num_compaction_trigger = 3; + options.level0_file_num_compaction_trigger = 6; options.num_levels = 4; options.compression = kNoCompression; - options.max_bytes_for_level_base = 450 << 10; + options.max_bytes_for_level_base = 4500 << 10; options.target_file_size_base = 98 << 10; options.max_write_buffer_number = 2; options.statistics = rocksdb::CreateDBStatistics(); @@ -657,10 +657,11 @@ TEST_F(DBTest, ReadLatencyHistogramByLevel) { DestroyAndReopen(options); int key_index = 0; Random rnd(301); - for (int num = 0; num < 5; num++) { + for (int num = 0; num < 7; num++) { Put("foo", "bar"); GenerateNewFile(&rnd, &key_index); } + dbfull()->TEST_WaitForCompact(); std::string prop; ASSERT_TRUE(dbfull()->GetProperty("rocksdb.dbstats", &prop)); @@ -676,6 +677,7 @@ TEST_F(DBTest, ReadLatencyHistogramByLevel) { // Reopen and issue Get(). See thee latency tracked Reopen(options); + dbfull()->TEST_WaitForCompact(); for (int key = 0; key < 500; key++) { Get(Key(key)); }