[Bug] Fix data evolution self-merge ABA across rollback snapshot lineage - #9363
Open
zhang-arvin wants to merge 1 commit into
Open
[Bug] Fix data evolution self-merge ABA across rollback snapshot lineage#9363zhang-arvin wants to merge 1 commit into
zhang-arvin wants to merge 1 commit into
Conversation
Member
|
Hi @zhang-arvin thanks for the changes the CI is failing, can you PTAL |
ArnavBalyan
suggested changes
Aug 23, 2026
| new RuntimeException( | ||
| ErrorMessages.DATA_EVOLUTION_SNAPSHOT_LINEAGE_CONFLICT_MESSAGE)); | ||
| } | ||
| if (baseSnapshotUuid != null |
Member
There was a problem hiding this comment.
Looks like Spark and Flink are using the single argument offloading causing the method to never get invoked. Would be better to capture and pass the UUID to the overloaded method.
Contributor
|
Add snapshot UUID-based lineage validation to prevent staged row-ID partial updates from being applied to wrong snapshots after a rollback reuses the same numeric snapshot ID. Three-layer validation in checkForRowIdFromSnapshot: 1. Fail closed when latest snapshot ID < base snapshot ID (rollback deleted the update's base snapshot) 2. Detect missing base snapshot (race with concurrent cleanup) 3. ABA detection: compare base snapshot UUID with current snapshot UUID at the same ID (different lineage) The baseSnapshotUuid field is nullable for backward compatibility. Callers that don't pass UUID get existing behavior without the ABA protection. Closes apache#9352
zhang-arvin
force-pushed
the
fix/data-evolution-self-merge-aba-snapshot
branch
from
August 24, 2026 03:29
e102180 to
bcfd450
Compare
Contributor
Author
|
Thanks for the review @ArnavBalyan @JingsongLi! Fixed the callers to pass snapshot UUID. Now BatchWriteBuilderImpl, DataEvolutionMergeIntoAction, and DataEvolutionDeleteSink all pass the UUID to rowIdCheckConflict. Added regression tests for ABA detection in ConflictDetectionTest. PTAL. |
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 changes were proposed in this pull request?
Fix #9352: Data evolution self-merge validates staged row-ID partial updates using base snapshot ID only, not snapshot UUID. A rollback can delete newer snapshots, after which new commits reuse the same numeric snapshot IDs. This allows staged updates from old snapshots to be applied to different replacement snapshots (ABA problem).
Changes
DataEvolutionConflictDetection: AddbaseSnapshotUuidfield and UUID-based lineage validationlatestSnapshot.id() < rowIdCheckFromSnapshot(rollback deleted base)baseSnapshotUuidwith current snapshot UUID at same IDConflictDetection: AddsetRowIdCheckFromSnapshot(Long, String)UUID overloadFileStoreCommit/FileStoreCommitImpl: Add UUID overloadInnerTableCommit/TableCommitImpl: Add UUID overloadErrorMessages: AddDATA_EVOLUTION_SNAPSHOT_LINEAGE_CONFLICT_MESSAGEBackward Compatibility
The
baseSnapshotUuidfield is nullable. Callers that don't pass UUID continue to work with existing behavior (no ABA protection).Follow-up
Caller layers (Spark
PaimonSparkWriter, FlinkDataEvolutionMergeIntoAction,BatchWriteBuilderImpl) should be updated to pass the snapshot UUID for full ABA protection.Related issues