[core] Optimize data evolution row-id assignment - #8904
Open
leaves12138 wants to merge 5 commits into
Open
Conversation
leaves12138
marked this pull request as ready for review
July 29, 2026 08:52
JingsongLi
reviewed
Jul 29, 2026
| private static final int EXCLUDED_PARTITION_CACHE_SIZE = 1024; | ||
| private static final int MAX_INITIAL_LIVE_FILE_RANGES = 1 << 24; | ||
| private static final String SKIP_CONTIGUOUS_ROW_COUNT = | ||
| "data-evolution.reassign.skip-contiguous-row-count"; |
JingsongLi
reviewed
Jul 29, 2026
| return false; | ||
| } | ||
|
|
||
| private static boolean rangesOverlap( |
Contributor
There was a problem hiding this comment.
Add this method to PrimitiveRowRanges.
JingsongLi
reviewed
Jul 29, 2026
| partitions.sort( | ||
| (left, right) -> { | ||
| int comparison = typedComparator.compare(left.partition, right.partition); | ||
| // Row IDs are globally unique, so this also orders binary-distinct |
Contributor
There was a problem hiding this comment.
Add tests for delete entries. They might move the deletion to the beginning here, but we should put it at the end. I understand that compaction will be performed here, so it won’t have any impact, but we want to make sure the tests run without any issues.
JingsongLi
reviewed
Jul 29, 2026
| this.logicalRanges = logicalRanges; | ||
| } | ||
|
|
||
| private void removeLargeContiguousRuns(long threshold, long[] result) { |
Contributor
There was a problem hiding this comment.
remove result and return real result.
JingsongLi
reviewed
Jul 29, 2026
| private static final String COMMIT_USER_PREFIX = "reassign-row-id"; | ||
| private static final int MAX_COMMIT_ATTEMPTS = 3; | ||
| private static final Projection RETRY_PROJECTION = | ||
| retryProjection(DataFileMeta.ROW_COUNT, DataFileMeta.FIRST_ROW_ID); |
Contributor
There was a problem hiding this comment.
ROW_RANGE_PROJECTION, move this to BinaryManifestEntry.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
BinaryManifestEntryscans.Why
Large data-evolution tables could allocate a very large backing array and spend most of planning time in comparison sorting. In addition, an APPEND-side manifest merge changed manifest file names and invalidated an otherwise reusable plan.
The planner now bounds temporary sorting arrays by chunk size, keeps primitive state, reduces mappings and rewrite work for large contiguous runs, and discovers the current manifests that contain already-planned ranges after an APPEND retry.
Impact
This changes only data-evolution row-id reassignment planning and retry handling. The large contiguous-run threshold defaults to 1,000,000,000 rows; setting
data-evolution.reassign.skip-contiguous-row-countto0disables that filtering. COMPACT and OVERWRITE snapshots still abort plan reuse.Validation
mvn -pl paimon-core -am -Dtest=DataEvolutionRowIdReassignerTest,LiveFileRowIdRangeCollectorTest -Dsurefire.failIfNoSpecifiedTests=false test