Drifter-yh opened a new pull request, #11592: URL: https://github.com/apache/rocketmq/pull/11592
### Which Issue(s) This PR Fixes - Fixes #10870 ### Brief Description `ProcessQueue#putMessage` assigned `queueOffsetMax` from every newly inserted message, so the last message of a batch won. When a batch arrives out of order (offsets 10 and then 5), the lower offset overwrites the real maximum and, once the queue is drained, `removeMessage` returns 6 instead of 11. A consumer that falls back to that stale next offset can re-pull messages it has already consumed. This change keeps the numeric maximum (`Math.max`) so the next offset always derives from the highest offset ever inserted. Added `ProcessQueueTest#testRemoveMessageWithOutOfOrderQueueOffsets`, which inserts offsets 10 and 5 and asserts that draining the queue returns 11. ### How Did You Test This Change? - `mvn -pl client -am clean test -Dtest=ProcessQueueTest -Dsurefire.failIfNoSpecifiedTests=false` on Windows 11, Microsoft OpenJDK 17.0.14 and Maven 3.9.2: 9 tests passed, 0 failures/errors/skips; Checkstyle (0 violations) and SpotBugs passed in the same reactor. - Reverted only the production change and reran the test: it failed with `expected: 11L but was: 6L`, confirming the regression is covered. - `git diff --check` passed. No broker integration test is claimed. AI assistance: DeepSeek Harness (deepseek-v4.1-flash) was used for analysis, implementation, and testing; the changes were reviewed and verified as described above. -- 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]
