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
This commit is contained in:
Dhruba Borthakur 2013-05-23 10:56:36 -07:00
parent c2e2460f8a
commit 898f79372f
2 changed files with 3 additions and 0 deletions

View File

@ -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));
}

View File

@ -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;