Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[r321] MQE: Fix panic in loading too many samples #10271

Merged
merged 1 commit into from
Dec 18, 2024

Conversation

grafanabot
Copy link
Contributor

Backport 34a24b1 from #10261

* MQE: Fix panic in loading too many samples

BucketedPool would create pools in powers of two up to a set
`maxSize`. That is, if `maxSize` isn't a power of two itself,
then the maximum bucket would be less than the maxSize.

However, when requesting a slice from the pool we were only checking
against the maxSize, and not whether a bucket existed for that size.
Instead calculate the bucketIndex and check if that exists
before using it.

* Use a power of two size max bucket

* MQE: Ensure BucketedPool always returns slices of power two

This is to guarantee they work with the ring buffers which expect slices
to always be power of two.

The limiting pool still protects us from requesting an unreasonable
amount of points with the MemoryConsumptionTracker.

* Fix tests

* Correctly return slices to their respective buckets or discard them

* Extra tests

* Address review feedback

* Remove unncessary slice length check

(cherry picked from commit 34a24b1)
@grafanabot grafanabot requested a review from a team as a code owner December 18, 2024 09:49
@grafanabot grafanabot requested a review from jhesketh December 18, 2024 09:49
@jhesketh jhesketh enabled auto-merge (squash) December 18, 2024 09:54
@jhesketh jhesketh merged commit cab4e99 into r321 Dec 18, 2024
30 checks passed
@jhesketh jhesketh deleted the backport-10261-to-r321 branch December 18, 2024 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants