-
Notifications
You must be signed in to change notification settings - Fork 408
[CELEBORN-2210] When a flushBuffer consolidation OOM exception occurs… #3547
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
Conversation
…, support setting the Buffer for fileInfo.
eb8561e to
8b9242a
Compare
| flushBuffer.consolidate() | ||
| fileInfo.setBuffer(flushBuffer) | ||
| try { | ||
| flushBuffer.consolidate() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is flushBuffer safe when call consolidate encounter OutOfMemoryError?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even if the consolidate() method fails, the flushBuffer object itself remains valid.When CompositeByteBuf encounters an OutOfMemoryError, it will not be corrupted; only the memory consolidation operation fails to complete. the data integrity of flushBuffer is guaranteed, and it can be safely used continuously.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An OutOfMemoryError exception only occurs when the allocBuffer method is called in CompositeByteBuf#consolidate0. Before this, the internal data structure of CompositeByteBuf has not been modified, so even if consolidate throws an exception, the original buffer can still be used.
|
@TheodoreLx Please help review this PR. Thanks. |
TheodoreLx
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
| flushBuffer.consolidate() | ||
| fileInfo.setBuffer(flushBuffer) | ||
| try { | ||
| flushBuffer.consolidate() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An OutOfMemoryError exception only occurs when the allocBuffer method is called in CompositeByteBuf#consolidate0. Before this, the internal data structure of CompositeByteBuf has not been modified, so even if consolidate throws an exception, the original buffer can still be used.
|
Thanks. merge to main(v0.7.0) |
…, support setting the Buffer for fileInfo.
What changes were proposed in this pull request?
When a flushBuffer consolidation OOM exception occurs, support setting the Buffer for fileInfo.
Why are the changes needed?
When a flushBuffer consolidation OOM exception occurs, the current logic does not allow setting the Buffer for fileInfo.
Does this PR resolve a correctness bug?
NO
Does this PR introduce any user-facing change?
NO
How was this patch tested?
CI