laskoviymishka commented on code in PR #912:
URL: https://github.com/apache/iceberg-go/pull/912#discussion_r3104055757
##########
table/table.go:
##########
@@ -316,6 +384,68 @@ func (t Table) doCommit(ctx context.Context, updates
[]Update, reqs []Requiremen
return New(t.identifier, newMeta, newLoc, t.fsF, t.cat), nil
}
+type retryConfig struct {
+ numRetries int
+ minWaitMs int
+ maxWaitMs int
+ totalTimeoutMs int
+}
+
+func readRetryConfig(props iceberg.Properties) retryConfig {
+ cfg := retryConfig{
+ numRetries: props.GetInt(CommitNumRetriesKey,
CommitNumRetriesDefault),
+ minWaitMs: props.GetInt(CommitMinRetryWaitMsKey,
CommitMinRetryWaitMsDefault),
+ maxWaitMs: props.GetInt(CommitMaxRetryWaitMsKey,
CommitMaxRetryWaitMsDefault),
+ totalTimeoutMs: props.GetInt(CommitTotalRetryTimeoutMsKey,
CommitTotalRetryTimeoutMsDefault),
+ }
+ if cfg.numRetries < 0 {
+ cfg.numRetries = 0
+ }
+
+ return cfg
+}
+
+// backoffDuration computes wait time for the given 0-based retry attempt
+// using exponential backoff (minMs << attempt) clamped to maxMs, with
+// jitter in [minMs, ceiling] to avoid retry stampedes while keeping a
+// non-zero floor between attempts. Java Iceberg uses a deterministic
+// exponential backoff here; we add jitter to reduce stampede risk on
+// concurrent Go writers. Backoff is client-local, so this does not
+// affect cross-client interop.
+func backoffDuration(attempt, minMs, maxMs int) time.Duration {
Review Comment:
now fixed.
--
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]