fangm0137 opened a new issue, #11556:
URL: https://github.com/apache/rocketmq/issues/11556

   ### Before Creating the Bug Report
   
   - [x] I found a bug, not just asking a question, which should be created in 
[GitHub Discussions](https://github.com/apache/rocketmq/discussions).
   
   - [x] I have searched the [GitHub 
Issues](https://github.com/apache/rocketmq/issues) and [GitHub 
Discussions](https://github.com/apache/rocketmq/discussions)  of this 
repository and believe that this is not a duplicate.
   
   - [x] I have confirmed that this bug belongs to the current repository, not 
other repositories of RocketMQ.
   
   
   ### Runtime platform environment
   
   Windows. Reproduced in a focused JUnit test using a scripted pull consumer.
   
   ### RocketMQ version
   
   branch: develop
   Source: PrintMessageByQueueCommand.java (Git blob 
9933189dddcab1d21a0a92ba4b974ee6ec8a9925).
   The focused JUnit run used locally built RocketMQ 5.5.0 distribution jars as 
dependencies.
   
   ### JDK Version
   
   OpenJDK 23.0.1 (compiled with javac --release 8).
   
   ### Describe the Bug
   
   When `mqadmin printMsgByQueue` scans a queue with a tag filter, one pull may 
return `NO_MATCHED_MSG` while advancing `nextBeginOffset`. The command 
currently stops scanning on this status. As a result, matching messages in 
later batches are omitted from the printed output and tag counts.
   
   ### Steps to Reproduce
   
   1. Exercise the command with `-t TestTopic -a broker-a -i 0 -s TagA -f true` 
and a scripted pull consumer.
   2. Use the queue range `[0, 33)`. For offset 0, return `NO_MATCHED_MSG` with 
`nextBeginOffset=32`.
   3. For offset 32, return `FOUND` with one `TagA` message and 
`nextBeginOffset=33`. Check the requested offsets and tag count.
   
   ### What Did You Expect to See?
   
   The command pulls at offsets 0 and 32 and reports a count of 1 for TagA. If 
an unmatched response does not advance the offset, the scan stops.
   
   ### What Did You See Instead?
   
   The unmodified scan requested only offset 0. The regression test failed with 
`expected:<[0, 32]> but was:<[0]>`. The command never read or counted the later 
matching message.
   
   ### Additional Context
   
   Related source: 
https://github.com/apache/rocketmq/blob/develop/tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageByQueueCommand.java
   
   I have a patch that continues at an advancing offset after an unmatched 
batch. The focused JUnit class passes all 6 tests with the patch, including the 
non-advancing-offset case.


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