Fokko opened a new issue, #4534:
URL: https://github.com/apache/iceberg-python/issues/4534

   **Apache Iceberg version:** main (development)
   
   ### Please describe the bug 🐞
   
   When a catalog reports `CommitFailedException` for a commit that landed, 
`Transaction.commit_transaction` calls `_attempt_landed()`, which looks for the 
attempt's snapshot IDs in the refreshed table. #4520 makes it accept any one of 
them. Suppose another writer commits on top and then expires all of the 
attempt's snapshots before the check. Then none are found, and the transaction 
either deletes its manifests (no retries left) or commits the data again 
(retries left). The other writer's snapshot still lists those manifests, so 
scans fail with `FileNotFoundError`.
   
   Reproduction with the `_commit_outcomes(..., after_lost=...)` helper from 
#4520 in `tests/table/test_commit_retry.py`, on a new table:
   
   ```python
   def append_on_top_and_expire() -> None:
       other = catalog.load_table(identifier)
       other.append(pa.table({"x": [9]}))
       
other.maintenance.expire_snapshots().by_id(other.snapshots()[0].snapshot_id).commit()
   
   with _commit_outcomes(catalog, "lost", after_lost=append_on_top_and_expire):
       table.append(pa.table({"x": [1]}))
   ```
   
   - `commit.retry.num-retries=0`: `append()` raises `CommitFailedException`, 
and the next scan fails with `FileNotFoundError`.
   - `commit.retry.num-retries=1`: `append()` returns, and the next scan fails 
with `FileNotFoundError`.
   
   ### Possible direction
   
   Before deleting a manifest, check whether any snapshot in the refreshed 
metadata still references it, and keep it if so. The review on #4520 suggests a 
narrower version that checks branch heads for the attempt's written manifests. 
Detecting the landed commit through its manifests would also stop the duplicate 
commit on retry. For Glue, #4533 fixes the cause in the catalog itself. A REST 
client can't do the same, because the server writes the metadata file and the 
client never learns its location.
   


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