[ISSUE #10943] Tolerate incomplete queue-offset metadata during message decoding - #10944
[ISSUE #10943] Tolerate incomplete queue-offset metadata during message decoding#10944Aias00 wants to merge 2 commits into
Conversation
Signed-off-by: liuhy <liuhongyu@apache.org>
Signed-off-by: liuhy <liuhongyu@apache.org>
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Summary
Good defensive fix for handling incomplete queue-offset metadata during message decoding.
The change adds null and bounds checks before accessing getMessageQueueOffset().get(i), preventing IndexOutOfBoundsException when the offset list is shorter than the message buffer list. This can happen with partial or corrupted metadata.
The fix is applied consistently in both EscapeBridge.decodeMsgList() and PopReviveService.decodeMsgList(), and only overrides the queue offset when the store actually supplied one, preserving the decoded offset otherwise.
Test coverage validates the fix with a scenario where the offset list is intentionally shorter than the message list.
LGTM.
Automated review by github-manager-bot
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #10944 +/- ##
=============================================
- Coverage 48.62% 48.51% -0.11%
+ Complexity 13692 13655 -37
=============================================
Files 1381 1381
Lines 101464 101468 +4
Branches 13187 13189 +2
=============================================
- Hits 49337 49231 -106
- Misses 46142 46223 +81
- Partials 5985 6014 +29 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
What does this PR do?
Makes message decoding tolerate valid message buffers when the corresponding queue-offset metadata is absent or shorter than the buffer list.
The fix covers both EscapeBridge and PopReviveService. Each applies a consume-queue offset only when one is available, otherwise retaining the decoded message.
Test
mvn -pl broker -Dtest=EscapeBridgeTest#decodeMsgListTest_messageOffsetMissing,PopReviveServiceTest#testDecodeMsgListWithoutQueueOffsets test
Closes #10943.