laskoviymishka commented on code in PR #912:
URL: https://github.com/apache/iceberg-go/pull/912#discussion_r3103536398
##########
table/table.go:
##########
@@ -303,10 +326,55 @@ func (t Table) AllManifests(ctx context.Context)
iter.Seq2[iceberg.ManifestFile,
}
func (t Table) doCommit(ctx context.Context, updates []Update, reqs
[]Requirement) (*Table, error) {
- newMeta, newLoc, err := t.cat.CommitTable(ctx, t.identifier, reqs,
updates)
+ cfg := readRetryConfig(t.metadata.Properties())
+
+ // Bound total retry time with a derived context so both the wait loop
+ // and the CommitTable call itself respect the deadline uniformly.
+ retryCtx, cancel := context.WithTimeout(ctx,
time.Duration(cfg.totalTimeoutMs)*time.Millisecond)
+ defer cancel()
+
+ var (
+ newMeta Metadata
+ newLoc string
+ err error
+ )
+
+ for attempt := 0; attempt <= cfg.numRetries; attempt++ {
+ if retryCtx.Err() != nil {
+ return nil, context.Cause(retryCtx)
+ }
+
+ newMeta, newLoc, err = t.cat.CommitTable(retryCtx,
t.identifier, reqs, updates)
+ if err == nil {
+ break
+ }
+
+ // Only retry on retryable commit conflicts. Unknown-state
errors
+ // (5xx, gateway timeouts) must NOT be retried because the
commit
+ // may have actually succeeded — retrying could duplicate work.
+ if !errors.Is(err, ErrCommitFailed) {
Review Comment:
yeah, intentional. Glue / SQL / Hive wrapping is a planned follow-up PR that
I'll send once this one lands.
The godoc on `ErrCommitFailed` already notes only REST wraps it today.
--
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]