Skip to content

Commit

Permalink
fix check
Browse files Browse the repository at this point in the history
Signed-off-by: Little-Wallace <[email protected]>
  • Loading branch information
Little-Wallace committed May 9, 2024
1 parent 2d0fdcf commit 98f28ed
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,19 @@ impl CompactionTaskValidationRule for TierCompactionTaskValidationRule {
return true;
}

// so the design here wants to merge multiple overlapping-levels in one compaction
let max_compaction_bytes = std::cmp::min(
self.config.max_compaction_bytes,
self.config.sub_level_max_compaction_bytes
* self.config.level0_overlapping_sub_level_compact_level_count as u64,
);

// If waiting_enough_files is not satisfied, we will raise the priority of the number of
// levels to ensure that we can merge as many sub_levels as possible
let tier_sub_level_compact_level_count =
self.config.level0_overlapping_sub_level_compact_level_count as usize;
let min_sub_level_compact_level_count = tier_sub_level_compact_level_count / 2;
if input.input_levels.len() < min_sub_level_compact_level_count
|| (input.input_levels.len() < tier_sub_level_compact_level_count
&& input.select_input_size < self.config.max_bytes_for_level_base)
if input.input_levels.len() < tier_sub_level_compact_level_count
&& input.select_input_size < max_compaction_bytes
{
stats.skip_by_count_limit += 1;
return false;
Expand Down
2 changes: 1 addition & 1 deletion src/meta/src/hummock/manager/compaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ impl HummockManager {
for input_ssts in &compact_task.input_ssts {
for sst in &input_ssts.table_infos {
existing_table_ids.extend(sst.table_ids.iter());
if sst.table_ids.len() > 0 {
if !sst.table_ids.is_empty() {
*table_size_info.entry(sst.table_ids[0]).or_default() +=
sst.file_size / (sst.table_ids.len() as u64);
}
Expand Down

0 comments on commit 98f28ed

Please sign in to comment.