Skip to content

Make opening driver connections cancellable via a ctx - #9909

Merged
begelundmuller merged 5 commits into
mainfrom
begelundmuller/drivers-open-ctx
Oct 5, 2026
Merged

begelundmuller merged 5 commits into
mainfrom
begelundmuller/drivers-open-ctx

Conversation

@begelundmuller

@begelundmuller begelundmuller commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor
  • Adds a ctx to drivers.Open and Driver.Open, and threads it into the blocking work each driver does at open time: the embedded ClickHouse binary download and readiness wait, dials, handshakes, pings and version checks.
  • The ctx is cancelled as soon as Open returns, so handles must not retain it. Handle-lifetime contexts are now named bgctx to keep the two apart.
  • Fixes storage.Client.OpenBucket capturing a cancellable ctx in its GCS credentials, which would have broken token refreshes on a long-lived bucket for non-service-account credential types.

Comment thread admin/testadmin/testadmin.go Outdated
Comment thread runtime/drivers/athena/olap_test.go Outdated
Comment thread runtime/drivers/azure/object_store_test.go Outdated
Comment thread runtime/drivers/clickhouse/clickhouse.go Outdated
Comment thread runtime/drivers/duckdb/open_ctx_test.go Outdated
Comment thread runtime/drivers/gemini/gemini.go
Comment thread runtime/storage/storage.go Outdated
@begelundmuller begelundmuller self-assigned this Oct 1, 2026
Comment thread runtime/storage/storage.go
@begelundmuller
begelundmuller merged commit ce4de96 into main Oct 5, 2026
14 checks passed
@begelundmuller
begelundmuller deleted the begelundmuller/drivers-open-ctx branch October 5, 2026 14:43
nishantmonu51 pushed a commit that referenced this pull request Oct 16, 2026
* Make opening driver connections cancellable via a `ctx`

* Don't let DuckDB per-connection init queries observe the open ctx

* Don't let the open ctx deadline break readonly ClickHouse connections

* Use t.Context() in tests and share the readonly ctx rule in ClickHouse

* Scope the cached BigQuery client's ctx to the handle, not the first request

(cherry picked from commit ce4de96)
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.

2 participants