Repository navigation
fix(cloudfetch): degrade non-positive download-thread counts to the default - #549
Merged
Merged
Conversation
vuanhphung
marked this pull request as ready for review
November 13, 2026 09:53
There was a problem hiding this comment.
Verdict: 1 Nit
Looks good. The fix runs in NewConnector after all options are applied, so it covers both the WithMaxDownloadThreads option and the DSN parameter (the DSN path goes through withUserConfig). Positive values are unchanged. I found no correctness, error-handling or test-coverage problems; the fake-Thrift CloudFetch test exercises the real download pool. One follow-up: the warning also fires on the kernel backend, where the setting has no effect. That is harmless.
Other findings
- ⚪ Nit —
README.md:331andCONNECTION_PARAMETERS.md:178still listmaxDownloadThreadswith no note on what happens when the value is <= 0.doc.gonow documents the warn-and-use-default behavior; mirroring that note in both tables would keep the docs consistent.
…efault WithMaxDownloadThreads(<=0) and maxDownloadThreads=<=0 bypassed the only clamp, which ran before options were applied. The CloudFetch scheduler then started no downloads, and the first read failed with "row number 0 is not contained in any arrow batch: EOF". NewConnector now normalizes the value after all options (including the DSN UserConfig), logs one warning naming the option and value, and uses the default of 10, matching the ODBC reference behavior for CLOUDFETCH-019. Fixes #439 Co-authored-by: Isaac <[email protected]> Signed-off-by: Vu Anh Phung <[email protected]>
…nightly The live #439 guard counted every request whose hostname differed from the raw configured value. A scheme- or port-prefixed DATABRICKS_PECOTESTING hostname therefore counted warehouse RPCs as CloudFetch downloads, and the download assertion became vacuous. The configured value is now parsed the way WithServerHostname parses it and compared case-insensitively, with a credential-free regression test. Also add the guard to the credentialed Thrift nightly selector, so it runs outside manual invocations. Co-authored-by: Isaac <[email protected]> Signed-off-by: Vu Anh Phung <[email protected]>
Mirror the doc.go note in README.md and CONNECTION_PARAMETERS.md. Co-authored-by: Isaac <[email protected]> Signed-off-by: Vu Anh Phung <[email protected]>
vuanhphung
force-pushed
the
fix/issue-439-nonpositive-download-threads
branch
from
November 13, 2026 18:25
5f90176 to
505f8d9
Compare
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.
WithMaxDownloadThreads(0),WithMaxDownloadThreads(-1)and the DSN formmaxDownloadThreads=<=0were accepted. Session open and execution succeeded, but the first CloudFetch read failed withrow number 0 is not contained in any arrow batch: EOF.NewConnectorapplies options afterconfig.WithDefaults(), so the only clamp (CloudFetchConfig.WithDefaults) never saw the user's value. The scheduler loopfor downloadTasks.Len() < MaxDownloadThreadsthen started no downloads.NewConnectornow normalizes the value after all options are applied. That also covers the DSN path, becauseOpenConnectorappliesParseDSN'sUserConfigas an option. A non-positive value logs one warning namingmaxDownloadThreads (WithMaxDownloadThreads)and the value, then uses the default of 10. This follows the ODBC spec reference: warn, keep the default, connect. Positive values, including very large ones, are unchanged. A non-numeric DSN value still failssql.OpenwithErrInvalidDSNFormat, like every other numeric DSN parameter.Verification:
mainit fails with the exact EOF.make lint(0 issues),make test,go test -race, and the kernel-tagged suite all pass. The one kernel-tagged failure,TestKernelCloudFetchDisabledPreservesUnsupportedServerError, fails identically onmainwith the published v1.4.0 archive.TestE2ECloudFetchNonPositiveMaxDownloadThreadsreads 300,000 rows over CloudFetch (presigned downloads counted) withWithMaxDownloadThreads(-1). It fails onmainwith the EOF, and is added to the credentialed Thrift nightly.-1on the kernel backend passes; the knob is inert there.TestInvalidClientSideCloudFetchKnobValueDoesNotFailSessionOpen(driver-test#1242, passthrough mode) passes on this branch and SKIPs (xfail) onmain.Performance: the change runs once per
NewConnectorand doesn't touch the CloudFetch scheduling or download code, so fetch performance can't change.Cross-driver state
cloudFetchThreadPoolSize(default 16) throwsDatabricksValidationExceptionfor <= 0 or non-numeric, ValidationUtil.java:61-75 @0cb8c24max_download_threads(default 10) is not validated;ThreadPoolExecutorraisesValueErrorat execute, download_manager.py:52 @5a1a7eccloudFetchConcurrentDownloadsis not user-settable, DBSQLClient.ts:157 @93a9112cloudfetch_max_chunks_in_memory(default 16): warns and skips on the session-conf path, session.rs:1229-1283 @db23442MaxChunksInMemory: WARN, keeps the default, kernel_connection.cpp:697-711 @ff8f0ffAdversarial review: converged in round 1 with no high findings; both mediums are fixed (the live test's CloudFetch download counter now normalizes the configured hostname, and the test runs in the nightly).
Fixes #439
This pull request and its description were written by Isaac.