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
main
Dhruba Borthakur 12 years ago
parent c2e2460f8a
commit 898f79372f
  1. 2
      db/db_test.cc
  2. 1
      util/ldb_cmd.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));
}

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

Loading…
Cancel
Save