You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Summary
The repository has several ways to implement simple retry loops. This PR
adds a new `internal/retrier` package that captures the common
denominator across all of them.
This PR already opportunistically migrates `common/retry.go` to use this
new package internally. Subsequent PRs will migrate existing call sites
to it, removing unnecessary middleware.
Design choices:
- **Value-aware predicate.** `Retrier[V].IsRetriable(V, error)` sees
both the polled value and any error, so state-driven polling (the
dominant pattern across the provider's waiters) is supported natively
without sentinel-error wrapping.
- **Factory-per-Run.** `Run` takes a `func() Retrier[V]` and invokes it
once per call. Each invocation gets its own retrier instance with
independent backoff state, making `Run` safe to use from multiple
goroutines with the same factory without locking.
- **Deterministic exponential backoff, no jitter.** The Databricks SDK
already absorbs transient errors, and state-polling waiters here do not
need cross-client decorrelation. The package is intended to sit on top
of the SDK for longer polls (e.g. resource state transitions); jitter
adds complexity without a corresponding benefit in that scenario. This
is not a one-way door; it can be revisited if a use case calls for it.
## Test plan
- [x] `go test ./internal/retrier/...` passes (12 cases across
BackoffPolicy initialization and exponential growth, `Run`
retry/value-aware/ctx-cancellation paths, `RunErr`, `RetryIf` wiring and
factory independence, `RetryIfErr` forwarding, `sleep` cancellation).
- [x] `go tool staticcheck ./internal/retrier/...` clean.
- [x] `make fmt lint ws` clean.
- [x] CI green.
Copy file name to clipboardExpand all lines: NEXT_CHANGELOG.md
+1-2Lines changed: 1 addition & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,6 +16,5 @@
16
16
17
17
### Internal Changes
18
18
19
+
* Add `internal/retrier` package for unified retry and backoff handling ([#5746](https://github.com/databricks/terraform-provider-databricks/pull/5746)).
19
20
* Pass `excludedAttributes=entitlements` on SCIM `/Me` requests ([#5725](https://github.com/databricks/terraform-provider-databricks/pull/5725)).
20
-
21
-
The provider only needs identity fields (`userName`, `id`, `externalId`) from `/Me`, never entitlements. Skipping the entitlement computation avoids an expensive `getEffectivePermissions` traversal on the SCIM backend, which has caused incidents on workspaces with large grant counts.
0 commit comments