diff --git a/src/meta/src/hummock/compaction/picker/base_level_compaction_picker.rs b/src/meta/src/hummock/compaction/picker/base_level_compaction_picker.rs index 52ea3017d49a2..c35920144010c 100644 --- a/src/meta/src/hummock/compaction/picker/base_level_compaction_picker.rs +++ b/src/meta/src/hummock/compaction/picker/base_level_compaction_picker.rs @@ -132,8 +132,12 @@ impl LevelCompactionPicker { } let overlap_strategy = create_overlap_strategy(self.config.compaction_mode()); - let trivial_move_picker = - TrivialMovePicker::new(0, self.target_level, overlap_strategy.clone()); + let trivial_move_picker = TrivialMovePicker::new( + 0, + self.target_level, + overlap_strategy.clone(), + self.config.target_file_size_base / 4, + ); trivial_move_picker.pick_trivial_move_task( &l0.sub_levels[0].table_infos, diff --git a/src/meta/src/hummock/compaction/picker/intra_compaction_picker.rs b/src/meta/src/hummock/compaction/picker/intra_compaction_picker.rs index 6f0bfced1cc03..a1cb7c1bcd045 100644 --- a/src/meta/src/hummock/compaction/picker/intra_compaction_picker.rs +++ b/src/meta/src/hummock/compaction/picker/intra_compaction_picker.rs @@ -267,7 +267,8 @@ impl IntraCompactionPicker { continue; } - let trivial_move_picker = TrivialMovePicker::new(0, 0, overlap_strategy.clone()); + let trivial_move_picker = + TrivialMovePicker::new(0, 0, overlap_strategy.clone(), u64::MAX); let select_sst = trivial_move_picker.pick_trivial_move_sst( &l0.sub_levels[idx + 1].table_infos, diff --git a/src/meta/src/hummock/compaction/picker/min_overlap_compaction_picker.rs b/src/meta/src/hummock/compaction/picker/min_overlap_compaction_picker.rs index dfbe6950c5b49..124159302d37e 100644 --- a/src/meta/src/hummock/compaction/picker/min_overlap_compaction_picker.rs +++ b/src/meta/src/hummock/compaction/picker/min_overlap_compaction_picker.rs @@ -406,7 +406,7 @@ impl NonOverlapSubLevelPicker { let ret = self.pick_sub_level(l0, level_handler, sst); if ret.sstable_infos.len() < self.min_expected_level_count - && ret.total_file_size < self.min_compaction_bytes + || ret.total_file_size < self.min_compaction_bytes { continue; } diff --git a/src/meta/src/hummock/compaction/picker/trivial_move_compaction_picker.rs b/src/meta/src/hummock/compaction/picker/trivial_move_compaction_picker.rs index 96fcc69175bdc..36f0e33ebe1ce 100644 --- a/src/meta/src/hummock/compaction/picker/trivial_move_compaction_picker.rs +++ b/src/meta/src/hummock/compaction/picker/trivial_move_compaction_picker.rs @@ -26,6 +26,7 @@ pub struct TrivialMovePicker { level: usize, target_level: usize, overlap_strategy: Arc, + min_size: u64, } impl TrivialMovePicker { @@ -33,11 +34,13 @@ impl TrivialMovePicker { level: usize, target_level: usize, overlap_strategy: Arc, + min_size: u64, ) -> Self { Self { level, target_level, overlap_strategy, + min_size, } } @@ -50,6 +53,10 @@ impl TrivialMovePicker { ) -> Option { let mut skip_by_pending = false; for sst in select_tables { + if sst.file_size < self.min_size { + continue; + } + if level_handlers[self.level].is_pending_compact(&sst.sst_id) { skip_by_pending = true; continue;