zeroshade commented on code in PR #1454:
URL: https://github.com/apache/iceberg-go/pull/1454#discussion_r3566791520
##########
table/table.go:
##########
@@ -705,20 +709,68 @@ func rebuildSnapshotUpdates(ctx context.Context, updates
[]Update, freshMeta Met
return result, orphanedPaths, nil
}
+const maxRetryDurationMs = uint64(math.MaxInt64 / int64(time.Millisecond))
+
type retryConfig struct {
numRetries uint
- minWaitMs uint
- maxWaitMs uint
- totalTimeoutMs uint
+ minWaitMs uint64
+ maxWaitMs uint64
+ totalTimeoutMs uint64
}
-func readRetryConfig(props iceberg.Properties) retryConfig {
- return retryConfig{
- numRetries: iceberg.PropUInt(props, CommitNumRetriesKey,
CommitNumRetriesDefault),
- minWaitMs: iceberg.PropUInt(props,
CommitMinRetryWaitMsKey, CommitMinRetryWaitMsDefault),
- maxWaitMs: iceberg.PropUInt(props,
CommitMaxRetryWaitMsKey, CommitMaxRetryWaitMsDefault),
- totalTimeoutMs: iceberg.PropUInt(props,
CommitTotalRetryTimeoutMsKey, CommitTotalRetryTimeoutMsDefault),
+func readRetryConfig(props iceberg.Properties) (retryConfig, error) {
+ numRetries := iceberg.PropUInt64(props, CommitNumRetriesKey,
CommitNumRetriesDefault)
+ if numRetries >= uint64(^uint(0)) {
+ return retryConfig{}, fmt.Errorf(
+ "invalid retry property %q=%d: retry count overflows
the attempt count",
+ CommitNumRetriesKey, numRetries)
+ }
+
+ cfg := retryConfig{
+ numRetries: uint(numRetries),
+ minWaitMs: iceberg.PropUInt64(props,
CommitMinRetryWaitMsKey, CommitMinRetryWaitMsDefault),
+ maxWaitMs: iceberg.PropUInt64(props,
CommitMaxRetryWaitMsKey, CommitMaxRetryWaitMsDefault),
+ totalTimeoutMs: iceberg.PropUInt64(props,
CommitTotalRetryTimeoutMsKey, CommitTotalRetryTimeoutMsDefault),
}
+
+ if cfg.minWaitMs == 0 {
Review Comment:
Minor: `minWaitMs` and `maxWaitMs` fall back to their defaults when parsed
as 0, but `totalTimeoutMs` doesn't get the same treatment — an explicit
`commit.retry.total-timeout-ms=0` stays 0. Worth confirming 0 is intended to
mean 'no timeout' here rather than falling back to the default like the wait
values do.
--
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]