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

[v23.1.x] admin_server/get_partition: Avoid oversized allocation #11928

Merged
merged 1 commit into from
Jul 6, 2023

Conversation

BenPope
Copy link
Member

@BenPope BenPope commented Jul 6, 2023

Backport of PR #11824

Fixes #11924

Conflicts:
src/v/redpanda/admin_server.cc

Due to 2cc38ee

I took the opportunity to extract reduce and reuse it.

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.1.x
  • v22.3.x
  • v22.2.x

Release Notes

Improvements

  • admin_server/get_partition: Avoid oversized allocation

@BenPope BenPope added this to the v23.1.14 milestone Jul 6, 2023
@BenPope BenPope self-assigned this Jul 6, 2023
Avoid oversized allocation by:
* Collecting summaries into a fragmented_vector
* Streaming the vector to an output_stream

The overload of `ss::json::json_return_type` that provides an
`ss::output_stream` requires a `std::function`, which is required to
be copyable, so wrap the `fragmented_vector` in a simple container
wrapper that holds the container by `ss::lw_shared_ptr`.

Another optimisation is moving rather than copying during accumulation.

Fixes redpanda-data#11674

Signed-off-by: Ben Pope <ben@redpanda.com>
(cherry picked from commit d32b250)

Conflicts:
	src/v/redpanda/admin_server.cc

Due to 2cc38ee

I took the opportunity to extract `reduce` and reuse it.
@BenPope BenPope force-pushed the backport-11824-v23.1.x branch from 1b95917 to 84ce4f6 Compare July 6, 2023 18:39
Copy link
Contributor

@michael-redpanda michael-redpanda left a comment

Choose a reason for hiding this comment

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

lgtm

@BenPope BenPope merged commit b5695a4 into redpanda-data:v23.1.x Jul 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants