regression for trigger compaction logic

Summary: as subject

Test Plan: manually run db_bench confirmed

Reviewers: dhruba

Differential Revision: https://reviews.facebook.net/D4809
main
heyongqiang 13 years ago
parent a098207c95
commit 21082fa13c
  1. 4
      db/db_bench.cc
  2. 11
      db/version_set.cc
  3. 2
      util/options.cc

@ -146,8 +146,8 @@ static int FLAGS_max_bytes_for_level_multiplier = 10;
// Number of files in level-0 that will trigger put stop. // Number of files in level-0 that will trigger put stop.
static int FLAGS_level0_stop_writes_trigger = 12; static int FLAGS_level0_stop_writes_trigger = 12;
// Nulber of files in level-0 that will slow down writes. // Number of files in level-0 that will slow down writes.
static int FLAGS_level0_slowdown_writes_trigger = 4; static int FLAGS_level0_slowdown_writes_trigger = 8;
// posix or hdfs environment // posix or hdfs environment
static leveldb::Env* FLAGS_env = leveldb::Env::Default(); static leveldb::Env* FLAGS_env = leveldb::Env::Default();

@ -702,15 +702,16 @@ VersionSet::VersionSet(const std::string& dbname,
compact_pointer_ = new std::string[options_->num_levels]; compact_pointer_ = new std::string[options_->num_levels];
max_file_size_ = new uint64_t[options_->num_levels]; max_file_size_ = new uint64_t[options_->num_levels];
level_max_bytes_ = new uint64_t[options->num_levels]; level_max_bytes_ = new uint64_t[options->num_levels];
max_file_size_[0] = options_->target_file_size_base;
level_max_bytes_[0] = options_->max_bytes_for_level_base;
int target_file_size_multiplier = options_->target_file_size_multiplier; int target_file_size_multiplier = options_->target_file_size_multiplier;
int max_bytes_multiplier = options_->max_bytes_for_level_multiplier; int max_bytes_multiplier = options_->max_bytes_for_level_multiplier;
int i = 1; for (int i = 0; i < options_->num_levels; i++) {
while (i < options_->num_levels) { if (i > 1) {
max_file_size_[i] = max_file_size_[i-1] * target_file_size_multiplier; max_file_size_[i] = max_file_size_[i-1] * target_file_size_multiplier;
level_max_bytes_[i] = level_max_bytes_[i-1] * max_bytes_multiplier; level_max_bytes_[i] = level_max_bytes_[i-1] * max_bytes_multiplier;
i++; } else {
max_file_size_[i] = options_->target_file_size_base;
level_max_bytes_[i] = options_->max_bytes_for_level_base;
}
} }
AppendVersion(new Version(this)); AppendVersion(new Version(this));
} }

@ -28,7 +28,7 @@ Options::Options()
level0_stop_writes_trigger(12), level0_stop_writes_trigger(12),
max_mem_compaction_level(2), max_mem_compaction_level(2),
target_file_size_base(2 * 1048576), target_file_size_base(2 * 1048576),
target_file_size_multiplier(10), target_file_size_multiplier(1),
max_bytes_for_level_base(10 * 1048576), max_bytes_for_level_base(10 * 1048576),
max_bytes_for_level_multiplier(10), max_bytes_for_level_multiplier(10),
expanded_compaction_factor(25), expanded_compaction_factor(25),

Loading…
Cancel
Save