From 898f79372f26b383b2d8dd844533f5e42ed57888 Mon Sep 17 00:00:00 2001 From: Dhruba Borthakur Date: Thu, 23 May 2013 10:56:36 -0700 Subject: [PATCH] Fix valgrind errors introduced by https://reviews.facebook.net/D10863 Summary: The valgrind errors were in the unit tests where we change the number of levels of a database using internal methods. Test Plan: valgrind ./reduce_levels_test valgrind ./db_test Reviewers: emayanke Reviewed By: emayanke CC: leveldb Differential Revision: https://reviews.facebook.net/D10893 --- db/db_test.cc | 2 ++ util/ldb_cmd.cc | 1 + 2 files changed, 3 insertions(+) diff --git a/db/db_test.cc b/db/db_test.cc index e5d90f19b..17b480e4a 100644 --- a/db/db_test.cc +++ b/db/db_test.cc @@ -591,6 +591,7 @@ TEST(DBTest, LevelLimitReopen) { } options.num_levels = 1; + options.max_bytes_for_level_multiplier_additional.resize(1, 1); Status s = TryReopen(&options); ASSERT_EQ(s.IsCorruption(), true); ASSERT_EQ(s.ToString(), @@ -598,6 +599,7 @@ TEST(DBTest, LevelLimitReopen) { "more levels than options.num_levels"); options.num_levels = 10; + options.max_bytes_for_level_multiplier_additional.resize(10, 1); ASSERT_OK(TryReopen(&options)); } diff --git a/util/ldb_cmd.cc b/util/ldb_cmd.cc index 46dc7edc2..9b96d0e09 100644 --- a/util/ldb_cmd.cc +++ b/util/ldb_cmd.cc @@ -681,6 +681,7 @@ void ReduceDBLevelsCommand::Help(string& ret) { Options ReduceDBLevelsCommand::PrepareOptionsForOpenDB() { Options opt = LDBCommand::PrepareOptionsForOpenDB(); opt.num_levels = old_levels_; + opt.max_bytes_for_level_multiplier_additional.resize(opt.num_levels, 1); // Disable size compaction opt.max_bytes_for_level_base = 1UL << 50; opt.max_bytes_for_level_multiplier = 1;