From a99f3fad202fec38578a2906926a613c46b81c02 Mon Sep 17 00:00:00 2001 From: Little-Wallace Date: Tue, 28 May 2024 17:10:38 +0800 Subject: [PATCH] revert some changes Signed-off-by: Little-Wallace --- .../picker/compaction_task_validator.rs | 2 +- src/meta/src/hummock/manager/compaction.rs | 31 +++++++------------ 2 files changed, 12 insertions(+), 21 deletions(-) diff --git a/src/meta/src/hummock/compaction/picker/compaction_task_validator.rs b/src/meta/src/hummock/compaction/picker/compaction_task_validator.rs index ac67db4f1698e..12151244505b2 100644 --- a/src/meta/src/hummock/compaction/picker/compaction_task_validator.rs +++ b/src/meta/src/hummock/compaction/picker/compaction_task_validator.rs @@ -184,7 +184,7 @@ impl CompactionTaskValidationRule for BaseCompactionTaskValidationRule { return true; } - if input.select_input_size < 2 * input.target_input_size { + if input.select_input_size < input.target_input_size { stats.skip_by_write_amp_limit += 1; return false; } diff --git a/src/meta/src/hummock/manager/compaction.rs b/src/meta/src/hummock/manager/compaction.rs index 63b87a234f6eb..fa34f45868bc4 100644 --- a/src/meta/src/hummock/manager/compaction.rs +++ b/src/meta/src/hummock/manager/compaction.rs @@ -1507,27 +1507,18 @@ impl HummockManager { compact_task .table_vnode_partition .insert(table_id, default_partition_count); + } else if (compact_table_size > compact_task_table_size_partition_threshold_low + || (write_throughput > self.env.opts.table_write_throughput_threshold + && compact_table_size > compaction_config.target_file_size_base)) + && hybrid_vnode_count > 0 + { + // partition for large write throughput table. But we also need to make sure that it can not be too small. + compact_task + .table_vnode_partition + .insert(table_id, hybrid_vnode_count); } else if compact_table_size > compaction_config.target_file_size_base { - if write_throughput > self.env.opts.table_write_throughput_threshold - && compact_table_size > compact_task_table_size_partition_threshold_low - && compact_task.base_level == compact_task.target_level - && default_partition_count > 0 - { - // Because the task to base level may be small, we shall partition it if the write throughput is high. - compact_task - .table_vnode_partition - .insert(table_id, default_partition_count); - } else if write_throughput > self.env.opts.table_write_throughput_threshold - || compact_table_size > compact_task_table_size_partition_threshold_low - { - // partition for large write throughput table. But we also need to make sure that it can not be too small. - compact_task - .table_vnode_partition - .insert(table_id, hybrid_vnode_count); - } else { - // partition for small table - compact_task.table_vnode_partition.insert(table_id, 1); - } + // partition for small table + compact_task.table_vnode_partition.insert(table_id, 1); } } compact_task