JingsongLi commented on code in PR #9363:
URL: https://github.com/apache/paimon/pull/9363#discussion_r4284164227
##########
paimon-python/pypaimon/write/commit/conflict_detection.py:
##########
@@ -193,8 +193,49 @@ def __init__(self, data_evolution_enabled,
snapshot_manager,
self.table = table
self._row_id_check_from_snapshot = None
self.fixed_bucket_commit_check = None
+ self._base_snapshot_uuid = None
self.commit_scanner = commit_scanner
+ SNAPSHOT_LINEAGE_CONFLICT_MESSAGE = (
+ "For Data Evolution table, the base snapshot lineage has changed,
possibly due to a"
+ " rollback. Staged updates from the old snapshot lineage cannot be
committed.")
+
+ def set_row_id_check_from_snapshot(self, snapshot_id,
base_snapshot_uuid=None):
+ """Set the base snapshot the staged update was planned against.
+
+ The snapshot UUID is captured so a rollback that deletes the base
snapshot and a later
+ commit that reuses the same numeric ID (ABA) can be detected at commit
time. Callers that
+ only know the ID leave the UUID None; full snapshot equality is then
used as a fallback.
+ """
+ self._row_id_check_from_snapshot = snapshot_id
+ if snapshot_id is None:
+ self._base_snapshot_uuid = None
+ return
+ if base_snapshot_uuid is None:
+ base = self.snapshot_manager.get_snapshot_by_id(snapshot_id)
Review Comment:
[P1] Carry the identity captured at staging into the commit. FileStoreCommit
now calls this setter with only check_from_snapshot, so this lookup captures
the replacement snapshot UUID after rollback, rather than the UUID used to
stage the update. Real Parquet/public-API reproduction: append (id=10,v=10),
append (20,20) as snapshot 2; stage v=999 for _ROW_ID=1 with
new_update_by_row_id().update_columns(); table.rollback_to(1); append (30,30),
reusing snapshot 2 and row ID 1 with a new UUID; commit the staged messages.
HEAD accepts the stale update and the final row is (id=30,v=999). Normal
matching-lineage control updates id=20 correctly. Passing the original UUID
captured before staging into this setter rejects the stale commit and preserves
(30,30). Please carry the captured base snapshot identity through the actual
update/CommitMessage/Ray path and add this real rollback/ID-reuse regression;
resolving it from the current ID during commit leaves the original silent
wrong-row bug
unfixed.
--
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]