rahulsmahadev commented on code in PR #4520:
URL: https://github.com/apache/iceberg-python/pull/4520#discussion_r4733983048
##########
pyiceberg/table/__init__.py:
##########
@@ -1289,10 +1289,10 @@ def _attempt_landed(self) -> bool:
f"Commit failed and the table could not be refreshed to check
whether it landed: {e}"
) from e
+ # A commit adds all of its snapshots or none, so finding one is
enough. Another writer may have
+ # expired the others, since no ref points at a snapshot once another
is committed on top of it.
added_snapshot_ids = {update.snapshot.snapshot_id for update in
self._updates if isinstance(update, AddSnapshotUpdate)}
- return bool(added_snapshot_ids) and all(
- self._table.metadata.snapshot_by_id(snapshot_id) is not None for
snapshot_id in added_snapshot_ids
- )
+ return any(self._table.metadata.snapshot_by_id(snapshot_id) is not
None for snapshot_id in added_snapshot_ids)
Review Comment:
One option would be to also count the attempt as landed when a refreshed
branch head still lists a manifest this attempt wrote
(`producer._written_manifests`), since a commit on top keeps them. In a scratch
copy that made the repro above pass with zero and one retry, kept the
all-snapshots-expired cases readable without duplicate rows, and `tests/table`
still passes.
--
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]