lilei1128 opened a new pull request, #11436:
URL: https://github.com/apache/paimon/pull/11436
### Purpose
Spark `sys.compact` previously compacted at most
`compaction.file-num-limit`
candidate files per call for unaware-bucket append tables, so tables with
many
small files required repeated calls.
Introduce `compaction.multi-batch.enabled` (default: false). When enabled,
one
call keeps scanning from the starting snapshot and plans/commits one batch
at a
time until all candidates are processed:
- `compaction.file-num-limit` bounds candidate files scanned per batch,
not the
files committed at once. Candidates can accumulate across batches, and
only
batches that produce compaction tasks are committed.
- Each batch commits separately, so completed batches survive a failure in
a
later batch. Concurrent file replacement or deletion-vector changes are
rejected by commit conflict detection.
- Snapshot, partition, consumer and tag expiration triggered by the call is
deferred until all batches finish. A failure during the final cleanup may
fail the CALL, but committed batches are not rolled back.
- The coordinator is pinned to the starting snapshot, so appends committed
afterwards are left for a later call.
Add `TableCommitImpl.expireOnCommit(boolean)` to defer automatic
expiration,
and document the new option and its semantics.
### Tests
-
`AppendOnlyTableCompactionTest#testLaterBatchRejectsConcurrentCompaction`:
verifies a later batch fails with a file deletion conflict whether the
rewrite starts before or after a concurrent commit replaces its inputs,
without changing data or the latest snapshot.
- `TableCommitTest#testExpireSnapshotsOnCommit`: verifies automatic
expiration
can be disabled per commit while explicit expiration and write-only
behavior
are preserved.
- `CompactProcedureTestBase`:
- single-batch default and dynamic disable, including a first batch with
no
task;
- multi-batch across limits 1/2, with and without write-only;
- deferred expiration after a post-commit callback failure;
- partition filter, deletion vectors, and `partition_idle_time`.
--
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]