Commit 5afbffd
committed
fix: align Apply() behavior with Java - don't revert last_update_committed_ on Transaction::Commit() failure
In Java's BaseTransaction, the hasLastOpCommitted flag tracks whether
PendingUpdate.commit() was called (which applies updates to transaction
metadata), NOT whether Transaction.commitTransaction() succeeded in
persisting to the catalog.
Once PendingUpdate.commit() is called and updates are applied to the
transaction's metadata, hasLastOpCommitted is set to true and stays true
even if Transaction.commitTransaction() fails later.
The previous implementation incorrectly reverted last_update_committed_
to false when auto-commit failed. This mixed two separate concerns:
1. Whether the pending update applied its changes (tracked by the flag)
2. Whether the transaction persisted to catalog (separate concern)
This fix:
- Removes the flag reversion on Commit() failure
- Matches Java behavior where the flag only tracks PendingUpdate state
- Simplifies Apply() by using ICEBERG_RETURN_UNEXPECTED
Reference: BaseTransaction.java in Apache Iceberg
- hasLastOpCommitted set to true in TransactionTableOperations.commit()
- Never reverted based on Transaction.commitTransaction() result1 parent 25c70c2 commit 5afbffd
1 file changed
+1
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
| 71 | + | |
76 | 72 | | |
77 | 73 | | |
78 | 74 | | |
| |||
0 commit comments