Repository navigation
fix(allocation-policies): Stop BytesScannedRejectingPolicy throttling every query - #8624
Merged
Merged
Conversation
…an limit is above ~3 TB BytesScannedRejectingPolicy asked the rate limiter for a fixed 1e12 bytes to find out how much quota was left. The rate limiter grants min(requested, remaining), so granted could never exceed 1 TB and used_quota = scan_limit - granted was overstated by scan_limit - 1 TB. For any scan_limit above ~3 TB the throttle check (granted < scan_limit - scan_limit // 1.5) was always true, so those tenants ran at half threads even with zero usage. quota_used was also wrong for every limit above 1 TB. Request scan_limit instead. check_within_quotas does not consume quota, so asking for the full limit only changes the reported remaining amount.
dezzeddi
marked this pull request as draft
October 29, 2026 06:11
dezzeddi
marked this pull request as ready for review
October 29, 2026 06:21
pbhandari
approved these changes
Nov 2, 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.
BytesScannedRejectingPolicyasked the rate limiter for a fixed 1e12 bytes (1 TB; the old constant namePETABYTEwas wrong). The limiter grantsmin(requested, remaining), sograntednever exceeded 1 TB.The policy computes
used = limit - granted, so usage looked far higher than it was. With a 20 TB limit and zero usage,used= 19 TB, which is over the throttle point (20 / 1.5 ≈ 13.3 TB), so every query is throttled. This happens for any limit above about 3 TB.Fix: request
scan_limit.check_within_quotasdoesn't consume quota, so only the reported remaining amount changes.