[ISSUE #10945] Align POP retry records with result batches - #10946
Conversation
Signed-off-by: liuhy <liuhongyu@apache.org>
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Summary
Correct fix for POP retry record index misalignment when a multi-message batch precedes retry messages.
The original code used the loop index i to access both getGetMessageResultList() and getPopConsumerRecordList(), but these lists have different cardinalities when a single GetMessageResult contains multiple messages. The fix correctly introduces a separate popConsumerRecordIndex that advances by getMessageQueueOffset().size() per batch, aligning the record index with the actual message count.
Test coverage is thorough — the new test validates the scenario with a 2-message normal result followed by a 1-message retry result.
LGTM.
Automated review by github-manager-bot
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #10946 +/- ##
=============================================
- Coverage 48.62% 48.54% -0.09%
+ Complexity 13692 13670 -22
=============================================
Files 1381 1381
Lines 101464 101466 +2
Branches 13187 13187
=============================================
- Hits 49337 49255 -82
- Misses 46142 46202 +60
- Partials 5985 6009 +24 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
What does this PR do?
Aligns the flattened POP consumer-record index with each fetched GetMessageResult. This keeps retry-message recoding associated with the correct result after a preceding multi-message batch.
Fixes #10945.
Test
mvn -pl broker -Dtest=PopConsumerServiceTest#popAsyncRecodeRetryMessagesAfterMultiMessageNormalResultTest test