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

   ## Problem
   
   `RocketMQMessageProvider.getQueueOffsets` lists the Queue Browser's queues 
with `queueData.getWriteQueueNums()`, but every other message-browse path is 
**read-queue** based:
   
   - the broker's `PullMessageProcessor` rejects any pull with `queueId >= 
topicConfig.getReadQueueNums()` (`SYSTEM_ERROR` "queueId is illegal");
   - `fetchSubscribeMessageQueues` — used by this provider's own `queryByTopic` 
and by the classic console's `queryMessageByTopic` — enumerates `[0, 
readQueueNums)`.
   
   So whenever a topic has `readQueueNums != writeQueueNums` (the standard 
expansion/shrink procedure sets the two counts independently, e.g. `updateTopic 
-r 16 -w 8`), the Queue Browser is wrong:
   
   - **read > write** (shrink draining): queues in `[write, read)` are still 
readable and still hold messages, but they never appear in the browser — the 
user cannot browse them at all, and the queue list disagrees with what 
`queryByTopic` scans.
   - **write > read** (queues not yet readable): queues in `[read, write)` are 
listed, but each one is a dead end — pulling from it fails with "queueId is 
illegal".
   
   The `writeQueueNums` iteration was introduced incidentally by the 
admin-client pooling refactor b5a7d6c0 (#2544), not as a deliberate 
queue-selection choice.
   
   ## Fix
   
   Enumerate `[0, queueData.getReadQueueNums())` in `getQueueOffsets`, matching 
the broker's pull validation and the read-queue enumeration used by the other 
browse paths. One-line change.
   
   ## Verification
   
   Base SHA: 36126024 (rocketmq-studio)
   
   Fail-before / pass-after on the two new tests in 
`RocketMQMessageProviderTest`:
   
   - `getQueueOffsetsListsReadQueuesWhenReadCountExceedsWriteCount` (read=4, 
write=2): failed with `[0, 1]` vs expected `[0, 1, 2, 3]`; passes after the fix 
(also asserts min/max offsets are wired per queue).
   - `getQueueOffsetsSkipsWriteOnlyQueuesWhenWriteCountExceedsReadCount` 
(read=2, write=4): failed with `[0, 1, 2, 3]` vs expected `[0, 1]`; passes 
after the fix.
   
   Full run after the fix:
   
   - `RocketMQMessageProviderTest`: 38/38 pass (36 pre-existing + 2 new)
   - whole `org.apache.rocketmq.studio.provider.apache` package: 256/256 pass
   
   **AI disclosure:** This change was prepared with AI assistance (GitHub 
Copilot/Claude-style tooling guided by a human contributor).


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