-
Notifications
You must be signed in to change notification settings - Fork 161
[#2526] improvement: Reset the chunkID if it overflow #2531
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
@@ -126,6 +126,13 @@ Chunk getChunk(int size) { | |||
private Chunk createChunk(boolean pool, int size) { | |||
Chunk chunk; | |||
int id = chunkID.getAndIncrement(); | |||
// if chunkID overflow | |||
if (id <= 0) { | |||
int maxChunkId = chunkIdMap.keySet().stream().mapToInt(Integer::intValue).max().orElse(0); |
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.
chunkIdMap
contains the chunk not in the chunk pool. Besides this is not thread-safe.
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.
We can add a variable to record the maximum chunk id in the chunk pool.
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.
@xianjingfeng, updated the code
server/src/main/java/org/apache/uniffle/server/buffer/lab/ChunkCreator.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/apache/uniffle/server/buffer/lab/ChunkCreator.java
Outdated
Show resolved
Hide resolved
…kCreator.java Co-authored-by: xianjingfeng <[email protected]>
…kCreator.java Co-authored-by: xianjingfeng <[email protected]>
Merged. Thanks for your contribution. @OmarBustamante |
What changes were proposed in this pull request?
If the chunId overflow it will reset it to (max chunk id in the chunk pool + 1)
Why are the changes needed?
Fix: #2526 Handle the possible overflow of the chunkId
Does this PR introduce any user-facing change?
No.
How was this patch tested?
Unit test