Skip to content

Glue: A commit that lands during a botocore retry is reported as CommitFailedException #4533

Backlog

Description

@Fokko

Apache Iceberg version: main (development)

Please describe the bug 🐞

GlueCatalog.commit_table calls glue.update_table(..., VersionId=...) for optimistic locking. The boto3 client retries automatically (standard mode, glue.max-retries defaults to 10). If Glue applies an attempt but the response is lost, for example on a read timeout or a 5xx, botocore sends the same request again with the same VersionId. Glue has already moved past that version and rejects it with ConcurrentModificationException. _update_glue_table maps that to CommitFailedException, although the commit landed.

CommitFailedException should mean the commit did not apply. Transaction.commit_transaction now works around this with _attempt_landed(), which looks for the transaction's snapshot IDs in the refreshed table. That check only runs for transactions that add snapshots. It also misses a landed commit whose snapshots another writer has already expired (#4534). A metadata-only change, like a schema update, that landed is still reported as failed.

Java fixed this in apache/iceberg#7198. GlueTableOperations.doCommit attaches a RetryDetector to the Glue client. When the commit fails after the client retried, or fails with an unexpected exception, it runs checkCommitStatus, which looks for the new metadata location in the table's current metadata and its metadata log:

  • found: the commit succeeded, and the exception is dropped
  • not found, and the error is ConcurrentModificationException: CommitFailedException
  • otherwise: CommitStateUnknownException

Proposed fix

Port this to GlueCatalog.commit_table. botocore records retries on errors in e.response["ResponseMetadata"]["RetryAttempts"], so no extra hook is needed. Because the check looks at metadata locations instead of snapshots, it still works after snapshots are expired.

Activity

  1. smaheshwar-pltr commented on Nov 30, 2026

    @smaheshwar-pltr
    Contributor

    Thanks for raising this 🙏 I was actually playing around with this a while back on my fork smaheshwar-pltr#32 (but I have yet to handle all the cases that Java does that you point out), so I'd be happy to polish that up to contribute this fix if no one else is on it yet! I do agree that being more resilient to this is good

    Edit: iterating on Iterating on #4535 in case that works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions