This is an automated email from the ASF dual-hosted git repository.

xianjingfeng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/uniffle.git


The following commit(s) were added to refs/heads/master by this push:
     new f2d7d868f [#2526] improvement: Reset the chunkID if it overflow (#2531)
f2d7d868f is described below

commit f2d7d868f30fb78e7ff9df925374febbb6684f91
Author: OmarBustamante <omar.bustama...@encora.com>
AuthorDate: Tue Jul 1 20:26:52 2025 -0700

    [#2526] improvement: Reset the chunkID if it overflow (#2531)
    
    ### 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
---
 .../main/java/org/apache/uniffle/server/buffer/lab/ChunkCreator.java | 5 +++++
 1 file changed, 5 insertions(+)

diff --git 
a/server/src/main/java/org/apache/uniffle/server/buffer/lab/ChunkCreator.java 
b/server/src/main/java/org/apache/uniffle/server/buffer/lab/ChunkCreator.java
index cfab30b87..36aa2b115 100644
--- 
a/server/src/main/java/org/apache/uniffle/server/buffer/lab/ChunkCreator.java
+++ 
b/server/src/main/java/org/apache/uniffle/server/buffer/lab/ChunkCreator.java
@@ -126,6 +126,11 @@ public class ChunkCreator {
   private Chunk createChunk(boolean pool, int size) {
     Chunk chunk;
     int id = chunkID.getAndIncrement();
+    // if chunkID overflow, reset it.
+    if (id <= 0) {
+      chunkID.compareAndSet(id, chunksPool.maxCount + 1);
+      id = chunkID.getAndIncrement();
+    }
     Preconditions.checkArgument(id > 0, "chunkId should be positive.");
     chunk = new OffheapChunk(size, id, pool);
     this.chunkIdMap.put(chunk.getId(), chunk);

Reply via email to