chennaji9 opened a new pull request, #6840:
URL: https://github.com/apache/rocketmq-dashboard/pull/6840

   ### Which Issue(s) This PR Fixes
   
   None — small self-contained fix found by inspection (no issue tracked).
   
   ### Brief Description
   
   `RocketMQMessageProvider.pullMessageAtOffset` treats any `FOUND` pull as the 
answer for the requested offset: it checks the pull status and takes the first 
message, without comparing the message's own `queueOffset`. A RocketMQ pull 
scans forward from the requested position, so when the exact offset has been 
invalidated (retention cleanup, compaction hole) the broker hands back the next 
retained message — and the exact-offset lookup presents that later message as 
"the message at offset N", silently hiding the gap. The caller cannot tell a 
real hit from a forward scan.
   
   The pulled message's `queueOffset` must now equal the requested offset; 
otherwise the lookup returns an empty result (the existing empty semantics for 
a cleared position) and logs which offset was actually matched.
   
   ### How Did You Test This Change?
   
   `mvn -B -ntp test -Dtest=RocketMQMessageProviderTest` → **Tests run: 84, 
Failures: 0** (82 existing + 2 new).
   
   New cases in `RocketMQMessageProviderTest` (mocked pull consumer, no broker 
needed):
   - `pullMessageAtOffsetReturnsNullWhenThePullStartsBeyondTheRequestedOffset` 
— asking for offset 10 with a `FOUND` message at offset 11 returns null;
   - `pullMessageAtOffsetReturnsTheMessageAtTheExactRequestedOffset` — a 
message at offset 10 is returned with its record populated.
   
   Red side: the same tests against the unfixed provider fail exactly on the 
mismatch case — the offset-11 message is returned as the offset-10 lookup.
   
   ### Checklist
   
   - [x] One coherent change; unrelated modifications are not bundled in
   - [x] Commit subject follows Conventional Commits (`fix:`)
   - [x] Tests added or updated for non-trivial changes (2 new red-green tests)
   - [x] New UI text has both Chinese and English entries under `web/src/i18n/` 
(n/a — no UI change)
   - [x] Architecture constraints stay green (same module, no new dependency)
   - [x] New source files carry the ASF license header (n/a — no new source 
file)
   - [x] Documentation touched where behaviour changed (n/a — the lookup now 
honours the exact-offset contract it already documented)
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
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]

Reply via email to