From c64796fd3418adc9830e2b3c043bf98cc44421d2 Mon Sep 17 00:00:00 2001 From: heyongqiang Date: Sun, 11 Nov 2012 22:33:22 -0800 Subject: [PATCH] Fix test failure of reduce_num_levels Summary: I changed the reduce_num_levels logic to avoid "compactRange()" call if the current number of levels in use (levels that contain files) is smaller than the new num of levels. And that change breaks the assert in reduce_levels_test Test Plan: run reduce_levels_test Reviewers: dhruba, MarkCallaghan Reviewed By: dhruba CC: emayanke, sheki Differential Revision: https://reviews.facebook.net/D6651 --- tools/reduce_levels_test.cc | 5 ----- util/ldb_cmd.cc | 2 +- util/options.cc | 2 +- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/tools/reduce_levels_test.cc b/tools/reduce_levels_test.cc index 6b70a54f3..f7e9377c2 100644 --- a/tools/reduce_levels_test.cc +++ b/tools/reduce_levels_test.cc @@ -118,21 +118,16 @@ TEST(ReduceLevelTest, Top_Level) { ASSERT_EQ(FilesOnLevel(0), 1); CloseDB(); - // The CompactRange(NULL, NULL) call in ReduceLevels - // will push this file to level-1 ASSERT_TRUE(ReduceLevels(4)); ASSERT_OK(OpenDB(true, 4, 0)); - ASSERT_EQ(FilesOnLevel(1), 1); CloseDB(); ASSERT_TRUE(ReduceLevels(3)); ASSERT_OK(OpenDB(true, 3, 0)); - ASSERT_EQ(FilesOnLevel(1), 1); CloseDB(); ASSERT_TRUE(ReduceLevels(2)); ASSERT_OK(OpenDB(true, 2, 0)); - ASSERT_EQ(FilesOnLevel(1), 1); CloseDB(); } diff --git a/util/ldb_cmd.cc b/util/ldb_cmd.cc index 6067f3b85..4b266a7df 100644 --- a/util/ldb_cmd.cc +++ b/util/ldb_cmd.cc @@ -252,7 +252,7 @@ leveldb::Options ReduceDBLevels::PrepareOptionsForOpenDB() { leveldb::Options opt = LDBCommand::PrepareOptionsForOpenDB(); opt.num_levels = old_levels_; // Disable size compaction - opt.max_bytes_for_level_base = 1L << 60; + opt.max_bytes_for_level_base = 1UL << 50; opt.max_bytes_for_level_multiplier = 1; opt.max_mem_compaction_level = 0; return opt; diff --git a/util/options.cc b/util/options.cc index 8d8478675..7f7081d2a 100644 --- a/util/options.cc +++ b/util/options.cc @@ -45,7 +45,7 @@ Options::Options() disable_seek_compaction(false), delete_obsolete_files_period_micros(0), max_log_file_size(0), - rate_limit(0.0), + rate_limit(0.0), no_block_cache(false), table_cache_numshardbits(4), CompactionFilter(NULL) {