RockteMQ-AI commented on issue #11360: URL: https://github.com/apache/rocketmq/issues/11360#issuecomment-6118113527
**Issue Evaluation** Category: `type/bug` | Status: **Confirmed** The reported issue has been verified against the current codebase (`e1eb99c85296`). **Root Cause:** `PopCheckPoint.compareTo` (line ~215) casts the result of `long` subtraction to `int`, truncating the high 32 bits. When two start offsets differ by more than `Integer.MAX_VALUE`, the sign inverts, breaking the `Comparable` total-order contract. **Additional finding:** The same defect pattern also exists at `PopReviveService.java:725` (`(int)(o1.getReviveOffset() - o2.getReviveOffset())`), used in the pop revive comparator. **Impact:** Broker pop revive path — `TreeMap` keyed by `PopCheckPoint` in `PopReviveService` can misorder entries or fail lookups when offsets span a >2GiB range. **Fix:** Replace `(int)(a - b)` with `Long.compare(a, b)` at both locations. This matches the pattern already applied in `ConsumerProgressSubCommand`, `PrintMessageByQueueCommand`, and `QueryMsgByUniqueKeySubCommand`. **Related PR:** #11361 already addresses this issue. --- *Automated evaluation by github-manager-bot* -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
