laskoviymishka commented on code in PR #912:
URL: https://github.com/apache/iceberg-go/pull/912#discussion_r3103521194


##########
table/table.go:
##########
@@ -37,6 +40,26 @@ import (
        "golang.org/x/sync/errgroup"
 )
 
+// ErrCommitFailed is the sentinel error returned by catalogs when a
+// commit fails due to a concurrent modification (e.g. HTTP 409 Conflict
+// from the REST catalog). Catalog implementations should wrap this
+// error so that callers using errors.Is(err, table.ErrCommitFailed)
+// can detect retryable commit conflicts.
+//
+// Currently only catalog/rest wraps this sentinel; Glue, SQL, and Hive
+// catalogs return their conflict errors raw and will not trigger
+// retries until follow-up work wires them through (tracked under
+// issue #830).
+//
+// The retry loop in doCommit re-issues the original updates and
+// requirements unchanged. This recovers only from transient catalog
+// errors (dropped connections, brief 409 during leader election); it
+// does not yet refresh the table metadata between attempts, so a
+// contended commit whose AssertRefSnapshotID requirement has been
+// invalidated by a peer will fail deterministically on every retry.
+// Refresh-and-replay is tracked separately (issue #830).
+var ErrCommitFailed = errors.New("commit failed, refresh and try again")

Review Comment:
   `table.ErrCommitFailed` is the portable sentinel so the retry loop in 
`table.doCommit` can detect a retryable conflict from any catalog without 
importing `catalog/rest`. REST wraps the portable one via `fmt.Errorf("%w: %w", 
ErrRESTError, table.ErrCommitFailed)`, so `errors.Is(err, 
table.ErrCommitFailed)` still matches REST errors. 
   



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