Skip to content

[#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

Merged
merged 7 commits into from
Jul 2, 2025

Conversation

OmarBustamante
Copy link
Contributor

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

@jerqi jerqi requested a review from xianjingfeng June 30, 2025 02:37
Copy link

github-actions bot commented Jun 30, 2025

Test Results

 3 049 files  ±0   3 049 suites  ±0   6h 46m 30s ⏱️ - 1m 39s
 1 188 tests ±0   1 187 ✅ ±0   1 💤 ±0  0 ❌ ±0 
15 067 runs  ±0  15 052 ✅ ±0  15 💤 ±0  0 ❌ ±0 

Results for commit 5eee210. ± Comparison against base commit ad7babb.

♻️ This comment has been updated with latest results.

@@ -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);
Copy link
Member

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.

Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@xianjingfeng, updated the code

@xianjingfeng xianjingfeng changed the title [#2526] improvement: Reset the chunkID if it is overflow [#2526] improvement: Reset the chunkID if it overflow Jul 2, 2025
@xianjingfeng xianjingfeng merged commit f2d7d86 into apache:master Jul 2, 2025
41 checks passed
@xianjingfeng
Copy link
Member

Merged. Thanks for your contribution. @OmarBustamante

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Improvement][LAB] Reset the chunkID if it is overflow
2 participants