Skip to content

Commit

Permalink
fix small table intra compact
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 28, 2024
1 parent e4c9ec1 commit 4aa3f40
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,13 @@ impl CompactionTaskValidationRule for IntraCompactionTaskValidationRule {
return false;
}

if input.current_level_size > self.config.sub_level_max_compaction_bytes
&& (input.select_input_size > self.config.max_bytes_for_level_base
|| input.input_levels.len() < intra_sub_level_compact_level_count * 2)
{
return false;
}

let mut max_level_size = 0;
for select_level in &input.input_levels {
let level_select_size = select_level
Expand All @@ -162,7 +169,7 @@ impl CompactionTaskValidationRule for IntraCompactionTaskValidationRule {
max_level_size * self.config.level0_sub_level_compact_level_count as u64 / 2
>= input.select_input_size;

if is_write_amp_large {
if is_write_amp_large || max_level_size > self.config.sub_level_max_compaction_bytes {
stats.skip_by_write_amp_limit += 1;
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ impl IntraCompactionPicker {

for (idx, level) in l0.sub_levels.iter().enumerate() {
if level.level_type() != LevelType::Nonoverlapping
|| level.total_file_size > self.config.sub_level_max_compaction_bytes
|| level.total_file_size > self.config.max_compaction_bytes
{
continue;
}
Expand Down Expand Up @@ -190,6 +190,7 @@ impl IntraCompactionPicker {
target_sub_level_id: level.sub_level_id,
select_input_size,
total_file_count: total_file_count as u64,
current_level_size: level.total_file_size,
..Default::default()
};

Expand Down
1 change: 1 addition & 0 deletions src/meta/src/hummock/compaction/picker/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ pub struct CompactionInput {
pub target_input_size: u64,
pub total_file_count: u64,
pub vnode_partition_count: u32,
pub current_level_size: u64,
}

impl CompactionInput {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ impl TierCompactionPicker {
target_level: 0,
target_sub_level_id: level.sub_level_id,
select_input_size: compaction_bytes,
target_input_size: 0,
total_file_count: compact_file_count,
vnode_partition_count,
..Default::default()
};

if !self.compaction_task_validator.valid_compact_task(
Expand Down

0 comments on commit 4aa3f40

Please sign in to comment.