Change L0 compaction score using level size
Summary: The goal is to avoid the problem of small number of L0 files triggering compaction to base level (which increased write-amp), while still allowing L0 compaction-by-size (so intra-L0 compactions cause score to increase). Closes https://github.com/facebook/rocksdb/pull/2172 Differential Revision: D4908552 Pulled By: ajkr fbshipit-source-id: 4b170142b2b368e24bd7948b2a6f24c69fabf73d
This commit is contained in:
parent
4623a5521f
commit
fa586740e3
@ -1314,9 +1314,9 @@ void VersionStorageInfo::ComputeCompactionScore(
|
||||
// Level-based involves L0->L0 compactions that can lead to oversized
|
||||
// L0 files. Take into account size as well to avoid later giant
|
||||
// compactions to the base level.
|
||||
uint64_t base_level_max_bytes = MaxBytesForLevel(base_level());
|
||||
score = std::max(
|
||||
score, static_cast<double>(total_size) / base_level_max_bytes);
|
||||
score, static_cast<double>(total_size) /
|
||||
mutable_cf_options.max_bytes_for_level_base);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user