Intra-L0 compactions are compactions from L0 to L0. They reduce read
amplification in scenarios where L0->Lbase compactions cannot keep
up. One such scenario is the sysbench/otlp_update_index benchmark
which is an update heavy workload.
Intra-L0 compactions are only scheduled when an existing L0->Lbase
compaction is already running. We copy the RocksDB heuristics which
require the compaction to involve a minimum of 4 L0 files, and to only
perform an intra-L0 compaction if the number of L0 files exceeds
L0CompationThreshold+2. Additionally, we copy the RocksDB heuristic
for determination of which files to include. Specifically, we keep on
adding files to the compaction as long as the average file size keeps
increasing. There isn't much commentary in RocksDB on what this
heuristic is doing, but it seems safer to replicate it rather than come
up with a different heuristic.
该提问来源于开源项目:cockroachdb/pebble