Repository navigation
perf(metadata): overlap table queries with catalog discovery - #490
vuanhphung wants to merge 10 commits into
Conversation
Speculate the literal scope while resolving catalog patterns and reuse only a successful result for one byte-identical catalog match. Preserve fallback queries and retry failed speculation after catalog confirmation. Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
Use distinct statement IDs so closing the failed catalog query cannot mask a leaked speculative table statement in the cleanup regression test. Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
Document how speculative table queries use JDBC unescaping while keeping active wildcard characters literal until catalog discovery confirms scope. Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
Keep a close guard while draining table metadata so dropping its future reaps the statement and retries an interrupted close. Server-closed inline results do not allocate a guard or send a cleanup request. Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
Reserve the literal's fan-out slot while polling the other executes first. This keeps a ready inline response from delaying their request submission. Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
Wait for asynchronous speculative requests and cleanup before verifying the filter-grid fixture, preserving the prompt metadata return path. Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
Hold executions behind a gate to enforce the reserved literal slot. Use non-pooled servers for speculative metadata fixtures and await unmatched cleanup before verification. 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: 1 Nit
Looks good, with 2 low concerns. The speculative execute is guarded and closed on every path I traced, catalog literals are backtick-escaped (sql.rs:155), and execute-only not-found retries are covered by the wiremock tests.
This overview is Claude Opus 5.5's initial take; some of its points were set aside by the cross-check judge — see the findings below.
Other findings
- ⚪ Nit — Every JoinError, including runtime-shutdown cancellation, becomes an Error::internal, which hides the cause category. Check is_cancelled() and map it to a cancelled or invalid-state error. This only matters during shutdown, so impact is minimal. (Found by Claude Opus 5.5 · confirmed by the judge)
🔀 1 finding considered and dismissed by the judge
- 🔵 Low
src/metadata_v0.rs:1018— When the speculative literal doesn't match any discovered catalog, its execute is detached bydrop(speculative)but keeps running, whileordinary_slotsstay
Judge's evidence:// Release completed unused responses now; pending executes finish // and close on the session runtime without gating ma…
|
On the JoinError nit: the execute handle is private and is never aborted. Canceling/dropping the metadata call detaches the execute so it can acquire its statement ID and close; the pending-execute and during-close cancellation tests cover that path. Ordinary request cancellation therefore does not produce this JoinError. Only task panic or runtime shutdown reaches this mapping, so I am leaving that shutdown-only categorization unchanged rather than changing steady-state behavior for a non-blocking nit. This comment was generated with GitHub MCP. |
Resolve the main changes by merging (no force-push). 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: 1 Nit
Looks good, with one low concern. The speculation lifecycle holds up: a dropped JoinHandle detaches the task and TablesCloseGuard closes the statement, a speculative result is reused only for an exact name match, and only execute-phase not-found is retried. The new tests use some tight timing bounds that could flake on slow CI.
Other findings
- ⚪ Nit — The new tests use tight wall-clock bounds, for example an 800 ms timeout around a roughly 550 ms path, a 300 ms close window and a 500 ms lookup-failure bound, so they could flake on a loaded CI runner. Widen the margins, or gate the mocks with a flag or Notify so the tests assert ordering instead of latency. (Found by Claude Opus 5.5 · confirmed by the judge)
Wildcard catalog lookup serializes
SHOW CATALOGSand scopedSHOW TABLES. Driver timestamps show roughly 300 ms before the table query starts for default underscore patterns such asmetadata_benchmarking.Execute the literal scope concurrently with discovery for patterns containing no uppercase, percent or star. Reuse its guarded response only for a byte-identical match, alongside the other bounded catalog queries. Unused responses release promptly or finish and close on the existing runtime. Only execute-not-found maps to empty; read/reshape errors propagate. Defaults, wildcard resolution, result shaping and telemetry stay unchanged.
Verification: 54 metadata tests, a reserved-slot mutant that fails 9 versus 8, 200 repetitions of each isolated cleanup regression, clippy and formatting pass. Metadata correctness is covered by a direct live Node kernel
getTablesharness (wildcard hit/multi-match/miss plus 23 value/order/schema/limit/close/cancel comparisons) and nine Python metadata tests. The 34-test Node kernel e2e suite does not callgetTables,getCatalogsorgetSchemas; add wildcard-hit/multi-match/miss cases there in a follow-up Node driver PR.Live ms below are median / p95=p99, n=5 fresh processes per side after warm-up, alternating order, with default catalog options (production source unchanged since these measurements).
The two-slow-catalog mock (50-ms discovery, 500-ms listings) is 561→560 ms; legacy SUCCEEDED multi-match is 221→221 ms with three POSTs/three closes on both builds. An eligible miss adds one FINISHED, empty listing to the user's query history on the tested SEA warehouse. On SUCCEEDED servers, an unused speculative close may follow an immediate session close; cleanup is best effort. Percent/uppercase control latency varies; no small control gain is claimed. Security Scan reports unchanged chrono@0.4.45 / RUSTSEC-2026-0543.
Adversarial review: converged after three rounds; high/medium findings fixed, low findings tested or documented, reserved-slot mutant killed.
This pull request and its description were written by Isaac.