From 0ad68518bb2e04707c06b6c87535b21ae44b6ced Mon Sep 17 00:00:00 2001 From: sdong Date: Mon, 30 Nov 2015 22:16:49 -0800 Subject: [PATCH] Fix DBCompactionTestWithParam.CompactionTrigger in non-jemalloc build. Summary: DBCompactionTestWithParam.CompactionTrigger fails in non-jemalloc build, after the skip list memtable change. Fix it by making mem table flush trigger by number of entries. Test Plan: Run the test using both of jemalloc and non-jemalloc build. Reviewers: anthony, IslamAbdelRahman, rven, kradhakrishnan, igor, yhchiang Reviewed By: yhchiang Subscribers: leveldb, dhruba Differential Revision: https://reviews.facebook.net/D51471 --- db/db_compaction_test.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/db/db_compaction_test.cc b/db/db_compaction_test.cc index baf35c672..631db2a91 100644 --- a/db/db_compaction_test.cc +++ b/db/db_compaction_test.cc @@ -461,12 +461,15 @@ TEST_F(DBCompactionTest, DisableStatsUpdateReopen) { TEST_P(DBCompactionTestWithParam, CompactionTrigger) { + int kNumKeysPerFile = 100; + Options options; - options.write_buffer_size = 110 << 10; // 110KB + options.write_buffer_size = 200 << 10; options.arena_block_size = 4 << 10; options.num_levels = 3; options.level0_file_num_compaction_trigger = 3; options.max_subcompactions = max_subcompactions_; + options.memtable_factory.reset(new SpecialSkipListFactory(kNumKeysPerFile)); options = CurrentOptions(options); CreateAndReopenWithCF({"pikachu"}, options); @@ -476,10 +479,11 @@ TEST_P(DBCompactionTestWithParam, CompactionTrigger) { num++) { std::vector values; // Write 100KB (100 values, each 1K) - for (int i = 0; i < 100; i++) { + for (int i = 0; i < kNumKeysPerFile; i++) { values.push_back(RandomString(&rnd, 990)); ASSERT_OK(Put(1, Key(i), values[i])); } + ASSERT_OK(Put(1, "", "")); dbfull()->TEST_WaitForFlushMemTable(handles_[1]); ASSERT_EQ(NumTableFilesAtLevel(0, 1), num + 1); }