diff --git a/db/compaction_picker.cc b/db/compaction_picker.cc index d8328ef87..ca813e38b 100644 --- a/db/compaction_picker.cc +++ b/db/compaction_picker.cc @@ -1058,6 +1058,10 @@ Compaction* UniversalCompactionPicker::PickCompaction( // If max read amplification is exceeding configured limits, then force // compaction without looking at filesize ratios and try to reduce // the number of files to fewer than level0_file_num_compaction_trigger. + // This is guaranteed by NeedsCompaction() + assert(sorted_runs.size() >= + static_cast( + mutable_cf_options.level0_file_num_compaction_trigger)); unsigned int num_files = static_cast(sorted_runs.size()) - mutable_cf_options.level0_file_num_compaction_trigger;