Skip to content

fix(session): open CloudFetch-disabled sessions on Real-Time warehouses - #456

Closed
vuanhphung wants to merge 3 commits into
mainfrom
perf/rd-h2-errors
Closed

vuanhphung wants to merge 3 commits into
mainfrom
perf/rd-h2-errors

Conversation

@vuanhphung

@vuanhphung vuanhphung commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

What did you change, and why?

Since #436, a session with CloudFetch disabled sends can_cloud_download=false at CreateSession to get paged inline results. Lakehouse Real-Time (Reyden) warehouses reject that setting:

HTTP 400: Invalid session params: [INVALID_CONF_VALUE] The value 'false' in the config "can_cloud_download" is invalid. SQLSTATE: 22022

So on those warehouses, use_cloud_fetch=False in the Python connector now fails at connect() with a ProgrammingError. With 1.4.0 it worked, because the kernel requested INLINE results instead.

Now, when CloudFetch is disabled and CreateSession rejects can_cloud_download, the kernel retries CreateSession once without it and requests INLINE results for that session, as 1.4.0 did. Any other CreateSession error still surfaces unchanged. INLINE carries the server's 25 MiB inline limit, so a larger result fails with "Inline byte limit exceeded", same as in 1.4.0. Warehouses that accept can_cloud_download keep the paged inline behavior from #436.

How do you know it works?

  • New wiremock tests: a rejected can_cloud_download falls back to INLINE, and an unrelated CreateSession rejection still surfaces.
  • cargo +stable fmt --all -- --check and cargo clippy --all-targets -- -D warnings pass. cargo test --no-fail-fast passes: 1,311 passed, 64 ignored. One unrelated test, v0_metadata_wiremock::primary_keys_rejects_invalid_current_namespace_and_closes_lookup, is flaky on main too (2 failures in 8 runs at db23442).
  • Live check on a Real-Time warehouse with connector main plus a wheel built from this branch:
    • connect(use_kernel=True, use_cloud_fetch=False) opens.
    • TPC-H Q6 returns the right result.
    • A 600,000-row (~100 MB) result fails with "Inline byte limit exceeded".
    • On main, the same connect() raises INVALID_CONF_VALUE.

Live benchmark (staging Large Reyden warehouse)

TPC-H Q6 on a Large Real-Time warehouse, 800 sessions (4 processes x 200 threads), cold start, each session querying back to back for 120 s, 16 client cores. Isolated A/B: only this change vs connector main 0c1b9e80 + kernel main db23442, both with use_cloud_fetch=False, 2 interleaved rounds, nothing else on the warehouse. Measured at 6333a2c. Median (min-max):

kernel main this PR
Failed connects (of 800) 800 (800-800) 0 (0-0)
Average QPS (setup included) - 2247 (2244-2251)
Steady QPS (after all sessions open) - 2292 (2291-2292)
Query latency p50 (ms) - 337 (337-337)
Client CPU per query (ms) - 1.12 (1.12-1.12)

Kernel main fails all 800 connects with use_cloud_fetch=False on this warehouse (HTTP 400 INVALID_CONF_VALUE can_cloud_download); with this PR all sessions open and run.

This pull request and its description were written by Isaac.

…ject can_cloud_download

Since #436, a session with CloudFetch disabled sends can_cloud_download=false at
CreateSession. Lakehouse Real-Time (Reyden) warehouses reject it with
INVALID_CONF_VALUE, so use_cloud_fetch=False now fails at connect() there. When
CreateSession rejects that setting, retry once without it and request INLINE
results for the session, which is what 1.4.0 did.

Signed-off-by: Vu Anh Phung <vu.phung@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>

@oss-reviewer-bot oss-reviewer-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: 1 Low

Looks good, with one low-severity test-coverage gap. The fallback only triggers when CloudFetch is disabled. On the retry, can_cloud_download is removed and the INLINE disposition is set before the second CreateSession is sent. Any other error still reaches the caller unchanged. The new wiremock test's body_string_contains mock with expect(1) checks that the retry body no longer carries can_cloud_download.

Comment thread src/client/sea.rs Resolved
Only an HTTP 400 that names can_cloud_download (case-insensitive) switches the
session to INLINE; other statuses and unrelated 400s do not.

Signed-off-by: Vu Anh Phung <vu.phung@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>

@oss-reviewer-bot oss-reviewer-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: 2 Low

Looks good: the fallback is narrowly scoped and covered by unit and wiremock tests. I found two low-severity points: the retry path drops the original error, and the error-message match could be stricter.

Comment thread src/client/sea.rs Resolved
Comment thread src/client/sea.rs Resolved
…s error

Fall back to INLINE only when the 400 rejects the can_cloud_download conf itself
(INVALID_CONF_VALUE ... config "can_cloud_download"). If the retried CreateSession
also fails, report both errors and leave the session's disposition unchanged.

Signed-off-by: Vu Anh Phung <vu.phung@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>

@oss-reviewer-bot oss-reviewer-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No issues identified by the review bot.

This branch was previously deployed

1 inactive deployment
azure-prod — 6333a2c4 Deployed Nov 13, 2026 by oss-reviewer-bot[bot] via followup #2837
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