hcrosse opened a new pull request, #2301:
URL: https://github.com/apache/iceberg-go/pull/2301

   ## Bug
   
   Since #2248, the SQL, Glue, Hive and Hadoop catalogs report a failed commit 
requirement as `table.ErrCommitFailed`. With `commit.retry.num-retries` > 0, 
`doCommit` now retries these failures, and `rewriteRefSnapshotRequirements` 
rewrites the commit branch's `AssertRefSnapshotID` to the refreshed head.
   
   `RollbackToSnapshot` and `ExpireSnapshots` use that assertion to detect a 
concurrent change, but they did not pin it the way 
`Transaction.AssertRefSnapshotID` does. A stale guard was therefore rebased and 
the commit went through:
   
   - A stale `RollbackToSnapshot`, committed after a peer's append, succeeds 
and discards the peer's append.
   - A stale `ExpireSnapshots(WithRetainLast(3))`, committed after a peer's 
rollback, succeeds and expires a snapshot inside the rolled-back branch's 
retention window.
   
   Reproduced on main with the SQLite catalog and `num-retries=2`. REST already 
had this, because a 409 maps to `ErrCommitFailed`.
   
   ## Fix
   
   - `RollbackToSnapshot` and `ExpireSnapshots` pin the refs they guard, using 
the same mechanism as `AssertRefSnapshotID`. This includes branches the 
transaction staged, whose absence assertion would otherwise be rebased onto a 
branch a peer created.
   - Pins and staged updates are published under one lock, so a failed apply 
leaves no pin.
   - An `ExpireSnapshots` that finds nothing to expire adds no requirements or 
pins, so it doesn't stop an append in the same transaction from rebasing. It 
still rejects a committed transaction.
   
   A pinned assertion that no longer holds is caught by the existing pre-retry 
check, so these commits fail on the first retry with `ErrCommitFailed` instead 
of using up the retry budget.
   
   ## Tests
   
   SQLite catalog tests for a stale rollback, a stale expiry, both cases on a 
branch the transaction staged, and an append combined with a no-op expiry. The 
first four fail on main. Table tests cover pin publication and the no-op expiry.
   


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to