From bcd7bd12293ac7e2cfaabe458b79ddfead84631a Mon Sep 17 00:00:00 2001 From: sdong Date: Tue, 1 Dec 2015 18:25:50 -0800 Subject: [PATCH] Relax verification condition of DBTest.SuggestCompactRangeTest Summary: Verifiction condition of DBTest.SuggestCompactRangeTest is too strict. Based on key distribution, we might have more small files in last level. Not check number of files in the last level. Test Plan: Run DBTest.SuggestCompactRangeTest with both of jemalloc on and off. Reviewers: rven, IslamAbdelRahman, yhchiang, kradhakrishnan, igor, anthony Reviewed By: anthony Subscribers: leveldb, dhruba Differential Revision: https://reviews.facebook.net/D51501 --- db/db_test.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/db/db_test.cc b/db/db_test.cc index f0ba57df1..6f47eee9a 100644 --- a/db/db_test.cc +++ b/db/db_test.cc @@ -8683,10 +8683,12 @@ TEST_F(DBTest, SuggestCompactRangeTest) { dbfull()->TEST_WaitForCompact(); } - ASSERT_EQ("0,0,13", FilesPerLevel(0)); + // All files are compacted + ASSERT_EQ(0, NumTableFilesAtLevel(0)); + ASSERT_EQ(0, NumTableFilesAtLevel(1)); GenerateNewRandomFile(&rnd); - ASSERT_EQ("1,0,13", FilesPerLevel(0)); + ASSERT_EQ(1, NumTableFilesAtLevel(0)); // nonoverlapping with the file on level 0 Slice start("a"), end("b"); @@ -8694,7 +8696,7 @@ TEST_F(DBTest, SuggestCompactRangeTest) { dbfull()->TEST_WaitForCompact(); // should not compact the level 0 file - ASSERT_EQ("1,0,13", FilesPerLevel(0)); + ASSERT_EQ(1, NumTableFilesAtLevel(0)); start = Slice("j"); end = Slice("m"); @@ -8704,7 +8706,8 @@ TEST_F(DBTest, SuggestCompactRangeTest) { options.compaction_filter_factory.get())); // now it should compact the level 0 file - ASSERT_EQ("0,1,13", FilesPerLevel(0)); + ASSERT_EQ(0, NumTableFilesAtLevel(0)); + ASSERT_EQ(1, NumTableFilesAtLevel(1)); } TEST_F(DBTest, PromoteL0) {