diff --git a/HISTORY.md b/HISTORY.md index 434d1af01..59811c189 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -52,6 +52,9 @@ ### Performance Improvements * Released some memory related to filter construction earlier in `BlockBasedTableBuilder` for `FullFilter` and `PartitionedFilter` case (#9070) +### Behavior Changes +* `NUM_FILES_IN_SINGLE_COMPACTION` was only counting the first input level files, now it's including all input files. + ## 6.26.0 (2021-10-20) ### Bug Fixes * Fixes a bug in directed IO mode when calling MultiGet() for blobs in the same blob file. The bug is caused by not sorting the blob read requests by file offsets. diff --git a/db/compaction/compaction_picker_universal.cc b/db/compaction/compaction_picker_universal.cc index cac6fcc1c..7ec7d3b93 100644 --- a/db/compaction/compaction_picker_universal.cc +++ b/db/compaction/compaction_picker_universal.cc @@ -498,8 +498,11 @@ Compaction* UniversalCompactionBuilder::PickCompaction() { } #endif // update statistics - RecordInHistogram(ioptions_.stats, NUM_FILES_IN_SINGLE_COMPACTION, - c->inputs(0)->size()); + size_t num_files = 0; + for (auto& each_level : *c->inputs()) { + num_files += each_level.files.size(); + } + RecordInHistogram(ioptions_.stats, NUM_FILES_IN_SINGLE_COMPACTION, num_files); picker_->RegisterCompaction(c); vstorage_->ComputeCompactionScore(ioptions_, mutable_cf_options_);