Uh oh!
There was an error while loading. Please reload this page.
direct: retry 504 errors - #5349
Conversation
Wraps adapter methods DoRead, DoDelete, DoUpdate, DoUpdateWithID, DoResize, WaitAfterCreate, and WaitAfterUpdate with retry logic that retries on HTTP 408/500/502/503/504 up to 2 times with a 30s interval (overridable via DATABRICKS_BUNDLE_RETRY_INTERVAL_MS for tests). DoCreate is intentionally not retried. Adds fault injection support to testserver (POST /__testserver/fault) so acceptance tests can inject transient errors dynamically, and two acceptance tests verifying retry on permissions PUT (update deploy) and GET (plan). Co-authored-by: Isaac
…DoCreate - Narrow retry condition to 504 errors SDK did not already handle - Add retrySafeError/retrySafe: resource impls wrap DoCreate errors to opt in to transient retries when the operation is idempotent - Wire DoCreate in adapter to retry only when both retrySafe and isTransient - permissions and grants DoCreate opt in (both delegate to a PUT/PATCH) - Update 504/create acceptance test: now expects retry success + 2 PUTs Co-authored-by: Denis Bilenko <denis.bilenko@databricks.com>
| // IsRetrySafe reports whether err was marked as safe to retry from DoCreate. | ||
| func IsRetrySafe(err error) bool { | ||
| var safe *retrySafeError | ||
| return errors.As(err, &safe) |
There was a problem hiding this comment.
I added a linter earlier this week to suggest errors.AsType[T]. Maybe the base SHA is not up to date?
| if err != nil { | ||
| return fmt.Errorf("waiting after creating id=%s: %w", newID, err) | ||
| if isTransient(ctx, err) { | ||
| log.Warnf(ctx, "waiting after creating id=%s: %s", newID, err) |
There was a problem hiding this comment.
waitRemoteState is not up to date but this falls through. Must either retry or fail hard.
There was a problem hiding this comment.
good catch. changed to retry.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
…an.go Adapter is a type-adaptation layer; retries are an operational concern. - New bundle/direct/retry.go: isTransient, retryWith/retryOnTransient/retryErr - dresources/retry.go: only retrySafe/IsRetrySafe/UnwrapRetrySafe (opt-in signal) - adapter.go: stripped to pure type adaptation - apply.go, bundle_plan.go: retries applied at each adapter call site Co-authored-by: Denis Bilenko <denis.bilenko@databricks.com>
…Update The create/update already succeeded; a 504 during status polling should not abort the deployment. Non-transient errors still fail hard. Co-authored-by: Denis Bilenko <denis.bilenko@databricks.com>
Co-authored-by: Denis Bilenko <denis.bilenko@databricks.com>
Co-authored-by: Denis Bilenko <denis.bilenko@databricks.com>
Co-authored-by: Denis Bilenko <denis.bilenko@databricks.com>
Co-authored-by: Denis Bilenko <denis.bilenko@databricks.com>
Co-authored-by: Denis Bilenko <denis.bilenko@databricks.com>
…site Co-authored-by: Denis Bilenko <denis.bilenko@databricks.com>
…warn+fallthrough Co-authored-by: Denis Bilenko <denis.bilenko@databricks.com>
Co-authored-by: Denis Bilenko <denis.bilenko@databricks.com>
Co-authored-by: Denis Bilenko <denis.bilenko@databricks.com>
Co-authored-by: Denis Bilenko <denis.bilenko@databricks.com>
Co-authored-by: Denis Bilenko <denis.bilenko@databricks.com>
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
eng-dev-ecosystem-bot
commented
May 28, 2026
Commit: 42f0cc1 |
Uh oh!
There was an error while loading. Please reload this page.
## Changes Retry resource methods that return an error that has http_code equal to 504 but that has not been retried by SDK. This affects all DoRead, DoUpdate(WithID), DoDelete. This affects DoCreate for grants and permissions. Note, for DoCreate the retry functionality is opt-in - implementations need to wrap error with retrySafe(). For other methods the retry is always enabled. ## Why We've seen reports where deploy fails with > Error: cannot create resources.pipelines.<pipeline>.permissions: The service at /api/2.0/permissions/pipelines/<pipeline_id> is taking too long to process your request. (504 TEMPORARILY_UNAVAILABLE) We also saw that terraform does custom retries for 504/GET databricks/terraform-provider-databricks#4355 Note, the two cases are different - the first one is "cannot create" so it refers to PUT. ## Tests New testserver feature that allows injecting expiring faults in a given endpoint. See fault.py. New acceptance tests make use of fault.py to check failures in plan/create/update for permissions.
eng-dev-ecosystem-bot
commented
May 28, 2026
Commit: 813b754 |
Follow up to #5349 Analysis shows 500 and 408 errors show up as well (although what we saw is those errors happen during file upload, but no reason it cannot happen on other endpoints).
## Release v1.2.0 ### CLI * `experimental open` now opens every DABs resource type that has a workspace URL, picking up `catalogs`, `schemas`, `volumes`, `database_instances`, `database_catalogs`, `synced_database_tables`, `postgres_catalogs`, `postgres_synced_tables`, `quality_monitors`, `vector_search_endpoints`, and `vector_search_indexes` ([#5346](#5346)). ### Bundles * Retry transient HTTP 5xx and 408 errors in direct deployment engine ([#5349](#5349), [#5364](#5364)). * Preserve `.designer.ipynb` suffix when translating notebook task paths so Lakeflow Designer files referenced from a `notebook_task` resolve correctly in the workspace ([#5370](#5370)). * Fix script output dropping last line without trailing newline ([#4995](#4995)). * engine/direct: Add `--select` flag to `bundle plan` and `bundle deploy` to plan/deploy a subset of resources (e.g. `--select my_job` or `--select jobs.my_job`); resources referenced by the selection are included transitively ([#5413](#5413)). * Support `purge_on_delete: true` on `postgres_projects` so bundles can hard-delete a Lakebase project on destroy (skipping the soft-delete retention window) ([#5414](#5414)). * Support terraform references in direct engine ([#5392](#5392)) * Support lifecycle.started for SQL warehouses ([#5348](#5348)) ### Dependency updates * Bump Go toolchain to 1.26.4 ([#5420](#5420)). * Bump `github.com/databricks/databricks-sdk-go` from v0.136.0 to v0.141.0 ([#5361](#5361)) * Bump Terraform provider from v1.115.0 to v1.117.0 ([#5421](#5421))
Changes
Retry resource methods that return an error that has http_code equal to 504 but that has not been retried by SDK.
This affects all DoRead, DoUpdate(WithID), DoDelete. This affects DoCreate for grants and permissions.
Note, for DoCreate the retry functionality is opt-in - implementations need to wrap error with retrySafe(). For other methods the retry is always enabled.
Why
We've seen reports where deploy fails with
We also saw that terraform does custom retries for 504/GET databricks/terraform-provider-databricks#4355
Note, the two cases are different - the first one is "cannot create" so it refers to PUT.
Tests
New testserver feature that allows injecting expiring faults in a given endpoint. See fault.py.
New acceptance tests make use of fault.py to check failures in plan/create/update for permissions.