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

Ensure fragment_vector fragments are always <= 128KiB #16958

Merged
merged 2 commits into from
Mar 8, 2024

Conversation

ballard26
Copy link
Contributor

Previously fragment_vector<T>::pow2_floor(size_t size) wouldn't correctly calculate the nearest power of 2 <= size. This resulted in cases such as;

sizeof(cluster::topic_status) * chunked_vector<cluster::topic_status>::elems_per_frag <= 128UL * 1024

not being true. This PR replaces pow2_floor with a standard library equivalent and adds a static assertion to ensure the size of fragments is always <= 128KiB.

Fixes #16957

Backports Required

  • none - not a bug fix
  • none - this is a backport
  • none - issue does not exist in previous branches
  • none - papercut/not impactful enough to backport
  • v23.3.x
  • v23.2.x

Release Notes

  • none

@piyushredpanda
Copy link
Contributor

Thanks for spotting the bug and the fix, @ballard26 !

Copy link
Member

@dotnwat dotnwat left a comment

Choose a reason for hiding this comment

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

lgtm

@piyushredpanda piyushredpanda merged commit 9e79a24 into redpanda-data:dev Mar 8, 2024
17 checks passed
@vbotbuildovich
Copy link
Collaborator

/backport v23.3.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants