[core] Refactor sort compact to produce COMPACT commits - #8631
[core] Refactor sort compact to produce COMPACT commits#8631hbgstc123 wants to merge 17 commits into
Conversation
c8a1b81 to
de2e634
Compare
Merge latest-snapshot deletion-vector metadata at rewrite time so concurrent DV writes are cleaned up, while keeping captured plan metadata for expired snapshots. Align Flink commit failure behavior with Spark by aborting write output when the COMPACT snapshot is not yet visible. Co-authored-by: Cursor <cursoragent@cursor.com>
…sed by subclasses Commit 0f5aecf changed commitUser, state, and write from protected to private, but GlobalFullCompactionSinkWrite and LookupSinkWrite still access them directly. This causes JDK 8 compilation failures. Restore protected visibility to fix the build. Co-authored-by: Cursor <cursoragent@cursor.com>
…pact restricts to append tables SortCompactAction now explicitly rejects primary-key tables and only supports bucket-unaware append tables. The dynamic-bucket test case exercises unsupported behavior and fails on Flink 2.x CI, so remove it. Co-authored-by: Cursor <cursoragent@cursor.com>
Sort compact now commits as COMPACT instead of OVERWRITE. Concurrent merge and sort compact on V2 delta row-level DV append tables can leave duplicate visible rows, so skip that combination and keep coverage on the V1 write path. Co-authored-by: Cursor <cursoragent@cursor.com>
de2e634 to
d462567
Compare
|
There is a data correctness issue with “Sort compact” and concurrent DV updates. Since “Sort compact” generates output based on an old snapshot but deletes the latest DV from the input file upon commit, this can cause deleted data to be restored. |
Right, just pushed a fix |
Resolve conflicts in FlinkSink and FlinkSinkBuilder by keeping both sort-compact writeProviderOverride/createAppendTableSink hooks and master's BLOB descriptor reader factory wiring. Co-authored-by: Cursor <cursoragent@cursor.com>
| return this; | ||
| } | ||
|
|
||
| private void validateSortCompactInput(List<DataSplit> compactInputSplits) { |
There was a problem hiding this comment.
Remove this method and two options. We don't need to restrict this.
Drop validateSortCompactInput and the warn/max input file options per review feedback. Co-authored-by: Cursor <cursoragent@cursor.com>
…ct_append_only Resolve conflict in BaseAppendDeleteFileMaintainer by keeping upstream javadoc. Co-authored-by: Cursor <cursoragent@cursor.com>
|
|
Co-authored-by: Cursor <cursoragent@cursor.com>
done |
|
|
||
| DataFileMeta assignSequenceNumber(long minSequenceNumber, long maxSequenceNumber); | ||
|
|
||
| default DataFileMeta assignFileSource(FileSource fileSource) { |
There was a problem hiding this comment.
Why add this method to interface default?
There was a problem hiding this comment.
DataFileMeta is @public, so a default method avoids breaking external implementations (same pattern as Table#newHybridSearchBuilder). However the only implementation in Paimon project is PojoDataFileMeta, and it has a real override. Happy to make it abstract
After making DataFileMeta#assignFileSource abstract, BinaryDataFileMeta from master must provide the method explicitly.
Purpose
Follow up on #7595 per this review comment: sort compact should not be modeled as an OVERWRITE commit with extra base-snapshot handling. Instead, it should produce a normal COMPACT commit so the existing commit protocol can perform compact validation and conflict detection.
This PR fixes the concurrent-write data loss risk in sort compact by refactoring Flink/Spark sort compact for append tables to:
CompactIncrementmessages.No new
overwritePartition(baseSnapshotId)APIs or special overwrite conflict logic are introduced.This is a follow-up to #8571, scoped to append tables only per review feedback.
Additional hardening on top of the COMPACT-commit refactor:
SortCompactPlanMetadataat planning time, so Flink commit recovery can still clean up DVs even if the base snapshot has expired.sort-compaction.warn-input-files/sort-compaction.max-input-filesto guard large sort compact plans whose input files are embedded in the Flink job graph.Tests
Core
SortCompactCommitMessageRewriterTestFlink
SortCompactCommitterTestSortCompactActionForAppendTableITCaseCommitterOperatorTestCompactProcedureITCaseupdated to expect COMPACTSpark
SortCompactSparkCommitTestCompactProcedureTestBaseupdated to expect COMPACT