Skip to content

[ISSUE #10852] fix(broker): sort revive offsets without overflow - #10857

Open
yuluo-yx wants to merge 1 commit into
apache:developfrom
yuluo-yx:0808-yuluo/fix-14
Open

[ISSUE #10852] fix(broker): sort revive offsets without overflow#10857
yuluo-yx wants to merge 1 commit into
apache:developfrom
yuluo-yx:0808-yuluo/fix-14

Conversation

@yuluo-yx

@yuluo-yx yuluo-yx commented Aug 8, 2026

Copy link
Copy Markdown
Member

Which Issue(s) This PR Fixes

Brief Description

Uses Long.compare to keep Pop revive checkpoints ordered by their full-width long offsets. Adds a regression test with offsets spanning the long range.

How Did You Test This Change?

mise x java@temurin-17 -- mvn -Dmaven.repo.local=/private/tmp/rocketmq-m2 -pl broker -am -DskipITs -Dtest=PopReviveServiceTest -Dsurefire.failIfNoSpecifiedTests=false test

The targeted tests, Checkstyle, and SpotBugs completed successfully.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 48.31%. Comparing base (fd0c959) to head (4856623).

Additional details and impacted files
@@              Coverage Diff              @@
##             develop   #10857      +/-   ##
=============================================
- Coverage      48.37%   48.31%   -0.07%     
+ Complexity     13555    13535      -20     
=============================================
  Files           1380     1380              
  Lines         101165   101165              
  Branches       13127    13127              
=============================================
- Hits           48940    48877      -63     
- Misses         46250    46300      +50     
- Partials        5975     5988      +13     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@RockteMQ-AI RockteMQ-AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM. Clean fix — replacing (int)(a - b) with Long.compare(a, b) eliminates the integer overflow risk when offsets differ by more than Integer.MAX_VALUE. The test case covering Long.MAX_VALUE offset gap is well-chosen.


Automated review by github-manager-bot

@yuluo-yx

yuluo-yx commented Aug 9, 2026

Copy link
Copy Markdown
Member Author

I confirmed the CI failure is not caused by this PR. Please rerun CI, thanks.

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.

Pop revive service may process large revive offsets out of order

3 participants