dragonknightk opened a new pull request, #11179: URL: https://github.com/apache/paimon/pull/11179
### Purpose Fixes #5130 In batch mode, `AppendCompactCoordinator` now compacts the small files that packing leaves in a partition when there are at least 2 of them. Before this change, such files were compacted only after `COMPACT_AGE` further planning rounds without new files in the partition. A batch compaction stops after planning its last scanned files, so the files left over in that plan stayed uncompacted. - The coordinator already knows the mode from its `isStreaming` constructor argument, which the Flink compact source, the Flink multi-table compact scan and the Spark compact procedure pass. No caller or option changes. - The leftover files form one extra task per partition, even when they are fewer than `compaction.min.file-num`. A single file is not compacted, because rewriting it alone does not reduce the file count. - In batch mode this applies to every plan. When the Flink batch source scans more files than `compaction.file-num-limit`, it plans once per chunk, so a partition can get one leftover task per chunk. - Streaming is unchanged: leftover files still wait for `COMPACT_AGE`. ### Tests - With deletion vectors enabled and `compaction.min.file-num = 3`, 14 files of a third of the target size pack into 2 tasks and leave 2 files. A streaming coordinator plans the 2 tasks and keeps the 2 files. A batch coordinator plans a third task with the 2 files, so the tasks cover all 14 files and nothing is kept. - On a table without deletion vectors, a batch compaction of 2 committed files below `compaction.min.file-num` produces 1 file with both rows, while a streaming coordinator plans nothing. - A batch coordinator does not compact a single file. - The first two scenarios fail on the code before this change. ## AI Disclosure Human-led contribution. Grok Bot, working for dragonknightk, assisted with this change, including the code, tests, and description. All submitted content was reviewed by a human before submission. (๑•̀ㅂ•́)و✧ -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
