Skip to content

Add WithConnectTimeout to bound and retry session establishment - #5

Open
r-jais wants to merge 1 commit into
mainfrom
connect-timeout
Open

Add WithConnectTimeout to bound and retry session establishment#5
r-jais wants to merge 1 commit into
mainfrom
connect-timeout

Conversation

@r-jais

@r-jais r-jais commented Aug 5, 2026

Copy link
Copy Markdown

What

Adds a WithConnectTimeout(d time.Duration) connection option and a Config.ConnectTimeout field. When set, connector.Connect bounds the whole OpenSession by that deadline and keeps retrying while the failure is transient (e.g. a cold-starting warehouse returning HTTP 503), stopping as soon as the deadline elapses.

Why

A non-serverless Databricks cluster that cold-starts can take minutes to accept a session. Today OpenSession is a single attempt whose retries are capped by the shared RetryMax (default 4), so a slow cold start fails well before the cluster is ready and there is no knob to wait longer. See dbt-labs/dbt-core#14529.

Behavior

  • ConnectTimeout <= 0 (default): a single attempt — identical to prior behavior. This is a purely additive mechanism; existing callers are unaffected.
  • ConnectTimeout > 0: retry OpenSession with exponential backoff (bounded by RetryWaitMin/RetryWaitMax) until success or the deadline. Retries here are independent of the query-level RetryMax, so query behavior is unchanged.
  • Non-retryable failures (bad token, missing warehouse, ...) fail fast — the loop only continues while errors.Is(err, RetryableError).

Tests

TestWithConnectTimeout (option sets the config; defaults to zero). Existing TestNewConnector unaffected.

Part of a cross-repo change

  1. this PR (databricks-sql-go) — the mechanism
  2. arrow-adbc — Databricks driver databricks.connect_timeout option + default, consuming this
  3. dbt-labs/fs — wire the connect_timeout profile field through

The consumer (2) can only bump its go.mod to depend on WithConnectTimeout once this is merged and tagged.

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.

1 participant