Repository navigation
Avoid waiting for cleanup of drained async statements - #507
Open
vuanhphung wants to merge 3 commits into
Open
vuanhphung wants to merge 3 commits into
vuanhphung wants to merge 3 commits into
Conversation
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
There was a problem hiding this comment.
🔀 Cross-reviewed: two independent reviews (Claude Opus 5.5 · GPT-6.1 Sol), checked by a judge model (Claude Sonnet 5.5).
Verdict: 2 Nit
Looks good: 2 low concerns. The drained-close detach logic, the drain signal's error handling and the Drop refactor all look correct, and the tests cover the mock-server and live-warehouse paths.
Other findings
- ⚪ Nit — napi/index.d.ts is the generated binding file and still carries the old close() doc, because the Rust doc comment changed in this PR without regenerating it. Regenerate index.d.ts, or edit it by hand, and commit it. (Found by Claude Opus 5.5 · confirmed by the judge)
- ⚪ Nit — The new tests/v0_async_close_logging_wiremock.rs starts directly with
useand has no Apache 2.0 license header. Every sibling test file begins with// Copyright (c) 2026 Databricks, Inc.and the license block. Add the standard header. (Found by Claude Opus 5.5 · confirmed by the judge)
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
Collaborator
Author
|
Fixed both judge-confirmed nits in 0374109: aligned the generated AsyncStatement.close() documentation and added the standard test license header. No runtime changes. This comment was generated with GitHub MCP. |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Async result consumers await a CloseStatement round trip after draining the result. On a warm live warehouse, SELECT 1 spends 113 ms of its 306 ms median in close. A 50 ms/route HTTPS mock confirms one request delay leaves the critical path; both variants still send one POST, status GET and DELETE per operation.
Once any result stream of an execution reaches successful EOF, detach the subsequent explicit close, even if another stream is unread or partly read. Ownership invalidates synchronously; cleanup errors are not returned or retried by Drop. Without a successful drain, close still awaits the RPC. Keep the statement alive until explicit close for independent readers and repeated fetches. Binding APIs stay unchanged; this is independent of #459 (response-body draining) and #472 (synchronous inline cleanup).
Testing
Workspace/binding tests, fmt/clippy, targeted live lifecycle/cancel/C ABI checks, logical value/type/null comparisons and mutation tests pass. Measurements below precede review hardening: five rotated fresh processes per variant, warmups discarded (25 native samples, 50 per binding).
Native close medians fall from 108–114 ms to 0.005–0.007 ms. No long-query end-to-end/tail gain is claimed: the five-second sample regressed overall, with variation concentrated in await_result. Sync control is unchanged (102.60 → 102.47 ms); mock totals are 155.13 → 103.74 ms. Reproduction and all samples are in the factory evidence handoff.
Additional notes
Cleanup is best-effort on runtime shutdown. A drained-close failure after session closure logs at debug, otherwise WARN; the synchronous drained path has the same session-close race on main and is unchanged here. Full external Go/ODBC/Node-driver suites were not run; C ABI/direct napi were checked. CI's integration status auto-passes PRs. The optional macOS symbol step cancels at 45 minutes on pinned main too; its workflow is unchanged.
Independent review confirms the gain back-to-back and through Python, with one extra pooled HTTP/1.1 connection per process; Drop's spawn intentionally now carries the session span.
Adversarial review: converged in round 1; all six scoped lows and both judged bot nits fixed, followed by a clean bot approval.
This pull request and its description were written by Isaac.