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

MQE: Tidy up pool size handling #10372

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jhesketh
Copy link
Contributor

@jhesketh jhesketh commented Jan 8, 2025

Primarily from feedback on #10261

Rather than allowing an arbitrary maxSize in pools, require them to be a power of two since that is what happens internally anyway.

We keep the checks and protections around requiring it to be a power of two.

What this PR does

Which issue(s) this PR fixes or relates to

Fixes #

Checklist

  • Tests updated.
  • Documentation added.
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX].
  • about-versioning.md updated with experimental features.

Primarily from feedback on grafana#10261

Rather than allowing an arbitrary maxSize in pools, require them to
be a power of two since that is what happens internally anyway.

We keep the checks and protections around requiring it to be a power of
two.
@jhesketh jhesketh requested a review from a team as a code owner January 8, 2025 10:27
Copy link
Contributor

@charleskorn charleskorn left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for addressing my feedback!

@@ -86,11 +87,15 @@ func (p *BucketedPool[T, E]) Put(s T) {
return // Ignore slices larger than the largest bucket
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we note here that we expect this will never happen given the maxSize check a few lines above and the fact that maxSize should be a power of two?

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.

2 participants