From 51ebf8d3ca6c8dd01451f9cd2c339eca79f03609 Mon Sep 17 00:00:00 2001 From: Leonardo Yvens Date: Sat, 6 Dec 2025 19:28:00 -0300 Subject: [PATCH] fix(compaction): fix Strict Eager Compaction predicate logic The predicate for Live files was returning `*size_exceeded` which meant files could only join a group when combined size ALREADY exceeded the target. Since two small files can never exceed 512 MiB, no groups were ever formed in "Strict Eager Compaction" mode (when eager_compaction_limit >= target_partition_size). Changed to `!*size_exceeded` to match Cold file behavior: files can join a group as long as combined size does NOT exceed the target. This allows accumulating many small files until they reach the target size. --- crates/core/dump/src/compaction/algorithm.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/crates/core/dump/src/compaction/algorithm.rs b/crates/core/dump/src/compaction/algorithm.rs index 5e6f545f0..e74c726fc 100644 --- a/crates/core/dump/src/compaction/algorithm.rs +++ b/crates/core/dump/src/compaction/algorithm.rs @@ -99,10 +99,9 @@ impl CompactionAlgorithm { .is_exceeded(&(candidate.size + group.size)); if state == FileState::Live { - // For live files, only compact if size limit is not exceeded. - // If it's the tail file, also require length limit to be exceeded - // (for cases where a minimum number of segments is desired before compaction). - *size_exceeded + // For live files, compact as long as size limit is not exceeded. + // This allows grouping many small files until they reach the target size. + !*size_exceeded } else if state == FileState::Hot { // For hot files, only compact if size limit is not exceeded, // and both files share the same generation.