Skip to content

Commit

Permalink
fix max size
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 6, 2024
1 parent 136929b commit d190577
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/meta/src/hummock/compaction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ pub fn create_compaction_task(
let target_file_size = if input.target_level == 0 {
compaction_config.target_file_size_base
} else if input.target_level == base_level {
let task_size = input.target_input_size + input.select_input_size'
let task_size = input.target_input_size + input.select_input_size;
if task_size < compaction_config.max_bytes_for_level_base {
// This is just a temporary optimization measure. We hope to reduce the size of SST as much
// as possible to reduce the amount of data blocked by a single task during compaction,
Expand All @@ -205,7 +205,13 @@ pub fn create_compaction_task(
compaction_config.target_file_size_base
} else {
const MAX_FILE_COUNT: u64 = 256;
std::cmp::max(compaction_config.target_file_size_base, task_size / MAX_FILE_COUNT)
std::cmp::min(
compaction_config.max_bytes_for_level_base,
std::cmp::max(
compaction_config.target_file_size_base,
task_size / MAX_FILE_COUNT,
),
)
}
} else {
assert!(input.target_level >= base_level);
Expand Down

0 comments on commit d190577

Please sign in to comment.