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

[fix][broker] Fix broker OOM when upload a large package. #22989

Merged
merged 2 commits into from
Jul 2, 2024

Conversation

shibd
Copy link
Member

@shibd shibd commented Jun 28, 2024

Motivation

Using package API to upload a large package may cause broker OOM.

Because in the current implementation, will copy all data to the heap.

while ((read = inputStream.read(readBuffer)) != -1) {
log.info("write something into the ledgers offset: {}, length: {}", offset, read);
ByteBuf writeBuf = Unpooled.copiedBuffer(readBuffer, 0, read);
offset += writeBuf.readableBytes();
LogRecord record = new LogRecord(offset, writeBuf);
records.add(record);

Modifications

Each time, only copy the size of one record and then upload it directly.

There is no need to worry about batching, as the distributedlog client will handle the batching.

Verifying this change

  • All related to package management test will pass.

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

Matching PR in forked repository

PR in forked repository:

@shibd shibd self-assigned this Jun 28, 2024
@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Jun 28, 2024
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 85.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 73.43%. Comparing base (bbc6224) to head (f5b8da1).
Report is 427 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #22989      +/-   ##
============================================
- Coverage     73.57%   73.43%   -0.15%     
- Complexity    32624    33266     +642     
============================================
  Files          1877     1907      +30     
  Lines        139502   142951    +3449     
  Branches      15299    15578     +279     
============================================
+ Hits         102638   104972    +2334     
- Misses        28908    29946    +1038     
- Partials       7956     8033      +77     
Flag Coverage Δ
inttests 27.52% <75.00%> (+2.93%) ⬆️
systests 24.73% <0.00%> (+0.40%) ⬆️
unittests 72.45% <85.00%> (-0.39%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
.../management/storage/bookkeeper/DLOutputStream.java 90.62% <85.00%> (-0.29%) ⬇️

... and 480 files with indirect coverage changes

Copy link
Contributor

@liangyepianzhou liangyepianzhou left a comment

Choose a reason for hiding this comment

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

Good Catch!

@shibd shibd requested a review from zymap July 1, 2024 14:11
@shibd shibd merged commit da2a191 into apache:master Jul 2, 2024
50 of 51 checks passed
shibd added a commit that referenced this pull request Jul 2, 2024
shibd added a commit that referenced this pull request Jul 2, 2024
shibd added a commit that referenced this pull request Jul 2, 2024
nikhil-ctds pushed a commit to datastax/pulsar that referenced this pull request Jul 10, 2024
srinath-ctds pushed a commit to datastax/pulsar that referenced this pull request Jul 15, 2024
nodece pushed a commit to ascentstream/pulsar that referenced this pull request Sep 4, 2024
@lhotari lhotari added this to the 4.0.0 milestone Oct 14, 2024
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.

7 participants