Skip to content

direct: Retry vector search index create while name is pending deletion - #6143

Merged
janniklasrose merged 2 commits into
mainfrom
janniklasrose/vector-search-polling-before-create
Aug 3, 2026
Merged

direct: Retry vector search index create while name is pending deletion#6143
janniklasrose merged 2 commits into
mainfrom
janniklasrose/vector-search-polling-before-create

Conversation

@janniklasrose

@janniklasrose janniklasrose commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Changes

Retry vector search index creation failures if the error indicates pending deletion.

Why

Recreating a vector_search_indexes resource could fail with Index ... is currently pending deletion.

Backend deletion completes in two phases: the index first disappears from GET, and only later is the name released for reuse. WaitAfterDelete polls GET, so it returns during phase one while the follow-up CREATE is still rejected. Polling GET cannot close this race because the two phases are observed on different endpoints, so this retries the CREATE itself — mirroring what apps already do for a create against an app in DELETING.

Tests

New local-only acceptance test bundle/resources/vector_search_indexes/recreate/pending_deletion, with the testserver modelling the two-phase deletion (scoped to index names containing vs_index_pending_deletion so other recreate tests are unaffected). output.txt shows both POSTs: the rejected one and the successful retry.

Verified the test fails without the resource change — the deploy exits 1 and leaves the index untracked in state. Full acceptance suite shows the same single pre-existing failure (bundle/templates/lakeflow-integrations) before and after.

This pull request and its description were written by Isaac, an AI coding agent.

Recreating a vector_search_indexes resource could fail with "Index ... is
currently pending deletion". Backend deletion completes in two phases: the
index first disappears from GET, and only later is the name released for
reuse. WaitAfterDelete polls GET, so it returns during phase one and the
follow-up CREATE is still rejected.

Polling GET cannot close this race because the two phases are observed on
different endpoints, so retry the CREATE itself instead. Mirrors what apps
already do for a create against an app in DELETING state.

The testserver now models the two-phase deletion, scoped to index names
containing vs_index_pending_deletion so other recreate tests are unaffected.

Co-authored-by: Isaac
@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

Integration test report

Commit: be6f8bf

Run: 30817614342

Env 💚​RECOVERED 🙈​SKIP ✅​pass 🙈​skip Time
💚​ aws linux 4 4 306 1069 5:07
💚​ aws windows 4 4 308 1067 4:29
💚​ azure linux 4 4 305 1069 4:34
💚​ azure windows 4 4 307 1067 3:48
💚​ gcp linux 1 5 306 1069 5:53
💚​ gcp windows 1 5 308 1067 5:47
8 interesting tests: 4 RECOVERED, 4 SKIP
Test Name aws linux aws windows azure linux azure windows gcp linux gcp windows
💚​ TestAccept 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
🙈​ TestAccept/bundle/invariant/no_drift 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_endpoints/drift/recreated_same_name 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_indexes/recreate/embedding_dimension 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/ssh/connection 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
💚​ TestFetchRepositoryInfoAPI_FromRepo 💚​R 💚​R 💚​R 💚​R 🙈​S 🙈​S
💚​ TestFetchRepositoryInfoAPI_FromRepo/root 💚​R 💚​R 💚​R 💚​R
💚​ TestFetchRepositoryInfoAPI_FromRepo/subdir 💚​R 💚​R 💚​R 💚​R
Top 3 slowest tests (at least 2 minutes):
duration env testname
5:00 gcp windows TestAccept
2:55 aws windows TestAccept
2:53 azure windows TestAccept

// The API exposes no DELETING state to poll for instead; remove this once it
// does, or once CREATE queues behind the pending delete rather than failing.
func (r *ResourceVectorSearchIndex) createIndex(ctx context.Context, req vectorsearch.CreateVectorIndexRequest) (*vectorsearch.VectorIndex, error) {
return retries.Poll(ctx, deleteIndexTimeout, func() (*vectorsearch.VectorIndex, *retries.Err) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deleteIndexTimeout is 15 minutes - let's fail faster initially (~ 1 minute) and see if we still observe the race on nightlies

Reusing deleteIndexTimeout (15 min) meant a stuck name release would hang
the deploy for a quarter hour. Fail fast instead and revisit if nightlies
still hit the race.

Co-authored-by: Isaac
@janniklasrose
janniklasrose enabled auto-merge August 3, 2026 13:28
@janniklasrose
janniklasrose added this pull request to the merge queue Aug 3, 2026
Merged via the queue into main with commit d8c6782 Aug 3, 2026
24 checks passed
@janniklasrose
janniklasrose deleted the janniklasrose/vector-search-polling-before-create branch August 3, 2026 13:55
deco-sdk-tagging Bot added a commit that referenced this pull request Aug 6, 2026
## Release v1.11.0

### CLI

 * Fixed `databricks repos get/update/delete` failing with `object at path "..." is not a repo` for Git-CLI-enabled folders (currently in preview), which the workspace API reports as directories rather than repos ([#6181](#6181)).
 * Support `dbfs:/Skills/...` paths in `databricks fs` commands, routed to the Files API. ([#6147](#6147))

### Bundles

 * For jobs where `ai_runtime_task.code_source_path` is a relative path to a local directory, the directory is now packaged into a tarball (honoring `.gitignore` and `sync.include`/`sync.exclude`), uploaded during deployment, and `code_source_path` is rewritten to the uploaded workspace path. ([#6110](#6110))
 * Added JSON output to `bundle init`. Running `databricks bundle init <template> -o json` now reports the files the template wrote, relative to the output directory. This lets callers that pass `--output-dir` learn where the template materialized instead of assuming the output is a single directory named after the project. The default text output is unchanged. ([#6161](#6161))
 * The terraform deployment engine is deprecated and will stop working in a future version of the CLI. Setting `bundle.engine: terraform` now emits a deprecation warning. See https://docs.databricks.com/aws/en/dev-tools/bundles/direct for how to migrate to the direct deployment engine. ([#6099](#6099))
 * Fixed the direct deployment engine planning a spurious `create` for an empty `grants: []` list. Terraform records no grants resource for such a list, so `bundle plan` after `bundle deployment migrate` no longer reports an action for it. Emptying a previously deployed list still revokes the grants, after which the node is dropped from the deployment state instead of being reported as unchanged forever. ([#6039](#6039))
 * Fixed `bundle generate` downloading notebooks found inside a folder without their file extension. They are now exported like top-level notebooks, so a Python notebook lands as `notebook.py` instead of an extensionless file ([#6144](#6144)).
 * direct: `webhook_notifications.on_*` destinations on jobs, tasks, and `for_each_task` are now compared as unordered sets. Previously the Jobs API returning these lists in a different order than submitted produced a phantom diff that `bundle plan` and `bundle deploy` could never converge past, reporting `1 to change` on every run ([#6060](#6060)).
 * Fixed a pipeline with `allow_duplicate_names: true` never converging on the direct engine: the field is only accepted on create/update and is never returned by the pipelines GET API, so every subsequent `bundle plan` reported the pipeline as a perpetual update. ([#6076](#6076))
 * direct: A local change to an input-only field (one the API accepts on write but never returns on read, e.g. pipelines' `run_as` or external locations' `skip_validation`) is no longer silently skipped when the new value coincidentally matches the field's fabricated remote value. Previously such a change could hit the `remote_already_set` shortcut and be dropped from the plan. ([#6112](#6112))
 * Revert usage of RedactiveSenstiveFields (added in [#5896](#5896), released in 1.10.0) which lead to incorrect behaviour (permanent drift) for duration field in Postgres resources ([#6179](#6179)).
 * Document postgres resource fields in the json schema ([#6164](#6164), [#6163](#6163)).
 * direct: Recreating a `vector_search_indexes` resource no longer fails with "Index ... is currently pending deletion" when the backend has not yet released the index name. The create is now retried until the name becomes available. ([#6143](#6143))

### Dependency Updates

 * Bump `github.com/databricks/databricks-sdk-go` from v0.165.0 to v0.166.0. ([#6175](#6175))
 * Upgrade Terraform provider to 1.124.0. ([#6174](#6174))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants