Fix client_prefetch_threads=0 normalization#2843
Open
abdulselamadillmohammed wants to merge 6 commits into
Open
Fix client_prefetch_threads=0 normalization#2843abdulselamadillmohammed wants to merge 6 commits into
abdulselamadillmohammed wants to merge 6 commits into
Conversation
sfc-gh-turbaszek
approved these changes
Apr 9, 2026
sfc-gh-turbaszek
approved these changes
Apr 9, 2026
|
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.
Please answer these questions before submitting your pull requests. Thanks!
What GitHub issue is this PR addressing? Make sure that there is an accompanying issue to your PR.
Fixes SNOW-3324331: client_prefetch_threads validation can bypass the lower bound due to ordering of casting and bounds checks #2841
Fill out the following pre-review checklist:
Please describe how your code solves the related issue.
This change makes the existing defensive validation path for client_prefetch_threads internally consistent when a non-positive value reaches it.
In the sync path, _validate_client_prefetch_threads() previously read through the defaulting property, which meant a raw value of 0 could resolve to DEFAULT_CLIENT_PREFETCH_THREADS instead of following the existing lower-bound correction. This PR updates the validator to normalize from the raw backing value, preserve None as the default case, and then apply the existing bounds logic before storing the final value.
I also included corresponding async updates so sync and async behavior stay aligned. In particular, async now validates direct assignment through the setter and continues to validate explicitly provided client_prefetch_threads values during connection setup.
The PR adds targeted sync and async unit tests covering:
N/A