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

c/partition_recovery_manager: avoid oversized allocations when logging #24476

Conversation

bashtanov
Copy link
Contributor

@bashtanov bashtanov commented Dec 6, 2024

https://redpandadata.atlassian.net/browse/CORE-8238

Do not dump the manifest JSON as it may be very large.

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

Release Notes

  • none

auto ostr = make_iobuf_ref_output_stream(buf);
co_await mat.partition_manifest.serialize_json(ostr);
auto istr = make_iobuf_input_stream(std::move(buf));
auto truncated = co_await istr.read_exactly(
Copy link
Contributor

Choose a reason for hiding this comment

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

what happens if you don't truncate?

arbitrary truncation looks odd especially if we ever come to rely on this information for debugging; if it is useless (and we are fine dropping it arbitrarily) then why are we printing it at all?

Copy link
Contributor Author

@bashtanov bashtanov Dec 6, 2024

Choose a reason for hiding this comment

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

what happens if you don't truncate?

  1. It's needs additional effort to log without oversized allocations (although it absolutely is possible)
  2. Potentially it also bloats the logs
    My reasoning was that if something is large enough to cause an oversized allocation (128Kb) it may also significantly bloat logs as there may be thousands of partitions to recover.

As for how useful this log line is, that's why I would like @Lazin's opinion, maybe he remembers.

Copy link
Member

Choose a reason for hiding this comment

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

dump 128kb to a single line is intense. surely there is a better solution than arbitrary truncation and dumping everything.

Do not dump partition manifest JSON as it can be very large
@bashtanov bashtanov force-pushed the avoid-oversized-allocation-when-logging branch from 5bd49fb to 28ec1df Compare December 9, 2024 15:33
@bashtanov bashtanov enabled auto-merge December 9, 2024 15:39
@bashtanov bashtanov merged commit a7b8b78 into redpanda-data:dev Dec 9, 2024
17 checks passed
bashtanov added a commit to bashtanov/redpanda that referenced this pull request Dec 10, 2024
Partition manifest logging was removed in redpanda-data#24476 to avoid oversized
allocations and very long log lines. This is to re-add it, but without
segments data.
bashtanov added a commit to bashtanov/redpanda that referenced this pull request Dec 10, 2024
Partition manifest logging was removed in redpanda-data#24476 to avoid oversized
allocations and very long log lines. This is to re-add it, with segment
data limited to last segment only.
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.

5 participants