Repository navigation
Conversation
… a failed create request After a create request fails with a 504, DoCreate looks the resource up by name and uses it if it was created no earlier than a minute before the request. These tests record what that does when the resource was created outside the bundle and the bundle's own request was never applied: deploy succeeds, and destroy deletes the resource. Co-authored-by: Isaac <no-reply@databricks.com>
Regression test report ✅Commit: Selected 7 changed tests (limit=20, 0 not selected) 9 tests: regression=0 unreleased=6 coverage=3 failing=0
TestAccept/bundle/resources/schemas/create_504_foreign/DMS=: branch ✅ | main (905b0f7) ✅ | latest (v1.28.0) ❌latest (v1.28.0): TestAccept/bundle/resources/schemas/create_504_foreign/DMS=true: branch ✅ | main (905b0f7) ✅ | latest (v1.28.0) ❌latest (v1.28.0): TestAccept/bundle/resources/vector_search_endpoints/create-504-foreign-during/DMS=: branch ✅ | main (905b0f7) ✅ | latest (v1.28.0) ❌latest (v1.28.0): TestAccept/bundle/resources/vector_search_endpoints/create-504-foreign-earlier/DMS=: branch ✅ | main (905b0f7) ✅ | latest (v1.28.0) ❌latest (v1.28.0): TestAccept/bundle/resources/vector_search_endpoints/create-504-foreign-type/DMS=: branch ✅ | main (905b0f7) ✅ | latest (v1.28.0) ❌latest (v1.28.0): TestAccept/bundle/resources/vector_search_endpoints/create-504-foreign/DMS=: branch ✅ | main (905b0f7) ✅ | latest (v1.28.0) ❌latest (v1.28.0): |
Co-authored-by: Isaac <no-reply@databricks.com>
…s a bug Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
✅ Integration test reportCommit: 64bf801
Top 6 slowest tests (at least 2 minutes):
|
Co-authored-by: Isaac <no-reply@databricks.com>
There was a problem hiding this comment.
Automated review at b05d590. Each finding was verified against the code.
No blocking issues found. 4 non-blocking comment(s) and 1 question(s) below.
This PR adds six local acceptance tests that record how the direct engine, after a create request fails with a 504, takes over a same-named resource the bundle did not create. Destroy then deletes it. No production code changes. The recorded outputs match what recoverCreate does today. The concrete issues are in the test scripts: they hand-write a jq projection where print_requests.py --summary already exists, and the race test's golden doesn't show the race. The PR description's timing note for create-504-foreign-during also no longer matches the script.
Questions
- What does
create-504-foreign-earliercover thatcreate-504-foreigndoesn't?recoverCreateaccepts any create time no earlier thanstart - createTimeSkew(one minute). Endpoints created 0 or 7 seconds before the deploy take the same path, andcreate-504-foreignalready creates the endpoint before a whole failing deploy. Should the test be dropped or folded intocreate-504-foreign?testing.mdsays to extend an existing directory when coverage overlaps. Or is there a case the 7-second sleep covers? (non-blocking)
Sankalp-Mittal
left a comment
There was a problem hiding this comment.
[AI Generated] Review by review-factory (Claude Sonnet 5.5 + Claude Opus 5.5 + Claude Opus 5.5, cross-verified). Only points the reviewers agreed on are posted.
No blocking or major issues found.
Co-authored-by: Isaac <no-reply@databricks.com>
Sankalp-Mittal
left a comment
There was a problem hiding this comment.
[AI Generated] Follow-up review by review-factory (Claude Sonnet 5.5 + Claude Opus 5.5 + Claude Opus 5.5, cross-verified). Only points the reviewers agreed on are posted.
Earlier findings: 4 still open.
No new issues found.
Co-authored-by: Isaac <no-reply@databricks.com>
Sankalp-Mittal
left a comment
There was a problem hiding this comment.
[AI Generated] Follow-up review by review-factory (Claude Sonnet 5.5 + Claude Opus 5.5 + Claude Opus 5.5, cross-verified). Only points the reviewers agreed on are posted.
No new issues found.
…of sleeps create-504-foreign-during ran the deploy in the background and created the endpoint during a 10 second retry pause, and create-504-foreign-earlier slept 7 seconds, so their output depended on the speed of the machine. Add a hook to the testserver: when a request that matches a pattern arrives, the server sends a given request itself, after the matching request is handled and before it is answered. The endpoint of the race test is now created by a hook on the deploy's lookup, between the failed create and its repeat. The endpoint of the earlier test is created by a hook on the deploy's create request, with a create time 30 seconds before it: a hook's request can shift the time its handler sees. Co-authored-by: Isaac <no-reply@databricks.com>
Sankalp-Mittal
left a comment
There was a problem hiding this comment.
[AI Generated] Review by review-factory (Claude Opus 5.5 + Claude Opus 5.5 + Claude Sonnet 5.5, cross-verified). Only points the reviewers agreed on are posted.
No blocking or major issues found.
Co-authored-by: Isaac <no-reply@databricks.com>
Changes
Seven local acceptance tests that record what the direct engine does today when a create request fails in a way that leaves its outcome unknown. In six, a resource with the bundle's name exists that the bundle did not create, and deploy takes it. In the seventh, the bundle did create the resource, and deploy does not take it. No production code changes; the testserver gets a hook for two of the tests.
After such a failure,
recoverCreate(bundle/direct/dresources/create_recovery.go) looks the resource up by name and uses it if its create time is no earlier than one minute before the first create request. For Unity Catalog resources it also requirescreated_byto be the deploying principal. Neither check tells a resource the bundle's request created from one that something else created in that window.In the first six tests the 504 is injected before the backend handles the create request, so the bundle creates nothing.
vector_search_endpoints/create-504-foreignCreated, the plan is clean, and destroy deletes the endpoint. The read response hascreator, which is not checked.postgres_projects/create_504_foreignstatus.owner, which is not checked.schemas/create_504_foreigncreated_bycheck passes.vector_search_endpoints/create-504-foreign-earliervector_search_endpoints/create-504-foreign-duringvector_search_endpoints/create-504-foreign-typeendpoint_typethan the one requested. Deploy takes it and the next plan isrecreate, so the next deploy would delete it.vector_search_endpoints/create-503-replayedEach test carries a
Badnessnote.Testserver hook
The last two tests need something to happen at an exact point of the deploy: an endpoint that appears between a failed create request and its repeat, and an endpoint that is a known time older than the request. A script can only approximate that with a background deploy and sleeps, and the output then depends on the speed of the machine. So this PR adds a hook to the testserver, next to the fault rules:
hook.py PATTERN OFFSET TIMES REQUEST [BODY](POST /__testserver/hook): when a request of the test that matchesPATTERNarrives, the server handlesREQUESTitself, with the test's token, after the matching request is handled (or failed by a fault rule) and before it is answered. The request is recorded like any other and fails the test if it is answered with an error.--clock-offset-ms Nshifts the time the handler ofREQUESTsees. Only the vector search endpoint create takes its time from the request so far (Request.nowMilli); the other handlers ignore the shift.create-504-foreign-duringputs the outside create on the deploy's lookup.create-504-foreign-earlierputs it on the deploy's create request, with the clock 30 seconds back. Neither test sleeps or runs anything in the background.Why
The takeover was introduced for vector search endpoints in #7599 and extended to more resources in #7602, #7747, #7757, #7767, #7782, #7801 and #7910. In #7910 a review comment raised it for schemas and a
created_bycheck was added for the Unity Catalog resources; the other resource types were left as they were. A Go-level check of all resource types shows 20 that take over a resource created just before the request by the same user.It needs two things at once: a create request that fails with a 504 (or another error that leaves the outcome unknown), and something else creating the same name within about a minute. That is rare, but the result is a deployment that manages, and on destroy deletes, a resource it did not create. Before #7599 the deploy failed.
These tests are evidence for deciding what to do about it. They are useful whichever way that goes.
Tests
The seven tests above. They run only against the testserver, since the fault is injected there. Unit tests for the hook are in
libs/testserver/hook_test.go: the order of the hook's request, a hook whose request matches its own pattern, and the shifted create time, compared with the create times of endpoints created before and after and not with the clock of the test.Gaps and risks
created_bycheck.create-504-foreign, bothcreate_504_foreignandcreate-504-foreign-type) create the resource with a CLI command right before the deploy. Their output holds as long as that takes less than a minute, which is the window they record.🤖 AI agent (fable5.2, isaac_claude)
This pull request and its description were written by Isaac.