Skip to content

[ISSUE #11556] fix(tools): continue printMsgByQueue after an unmatched batch - #11557

Open
fangm0137 wants to merge 3 commits into
apache:developfrom
fangm0137:fix/print-msg-by-queue-tag-scan
Open

fangm0137 wants to merge 3 commits into
apache:developfrom
fangm0137:fix/print-msg-by-queue-tag-scan

Conversation

@fangm0137

Copy link
Copy Markdown
Contributor

Which Issue(s) This PR Fixes

Brief Description

printMsgByQueue stops on NO_MATCHED_MSG even when the pull result advances nextBeginOffset, so a later batch with matching messages can be skipped. Continue scanning when the unmatched result advances the offset, and stop when it does not advance. The command still stops on NO_NEW_MSG or OFFSET_ILLEGAL.

How Did You Test This Change?

Ran PrintMessageByQueueCommandTest with JUnit 4.13.2 using the upstream command sources compiled with javac --release 8 and local RocketMQ 5.5.0 distribution jars. The scripted consumer returned an unmatched batch at offset 0 and a matching TagA message at offset 32. The regression failed before the fix because the command only requested offset 0. All six tests passed after the fix, including the case where the unmatched result did not advance the offset.

@codecov-commenter

codecov-commenter commented Nov 23, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 49.97%. Comparing base (28960fd) to head (6f31e3c).
⚠️ Report is 3 commits behind head on develop.

Additional details and impacted files
@@              Coverage Diff              @@
##             develop   #11557      +/-   ##
=============================================
+ Coverage      49.86%   49.97%   +0.10%     
- Complexity     14454    14468      +14     
=============================================
  Files           1391     1391              
  Lines         103432   103442      +10     
  Branches       13550    13552       +2     
=============================================
+ Hits           51573    51690     +117     
+ Misses         45636    45512     -124     
- Partials        6223     6240      +17     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@fangm0137

Copy link
Copy Markdown
Contributor Author

Added a unit test for the default createConsumer implementation in 6f31e3c. It verifies that the consumer uses MixAll.TOOLS_CONSUMER_GROUP and covers the line flagged by Codecov.

Local validation passed: all 7 tests in PrintMessageByQueueCommandTest pass (JUnit 4.13.2, sources compiled with javac --release 8 against RocketMQ 5.5.0 distribution jars). JaCoCo confirms that the previously uncovered line is fully covered.

The workflow runs for this update are awaiting maintainer approval. Could a maintainer please approve them so CI and Codecov can run on the latest commit? Thank you.

@fangm0137

Copy link
Copy Markdown
Contributor Author

RecallWithTraceIT timed out after 30 seconds while waiting for its test topic to become available. The same timeout occurs on develop at 8c36598, the base commit used by this PR's failing CI run. Failing run on develop

I reproduced the timeout locally. The test passed after I added a call to waitBrokerRegistered(...) before IntegrationTestBase.initTopic(...) in RecallWithTraceIT's @BeforeClass setup.

Would it make sense to fix the integration test setup in a separate PR so this one can stay focused on printMsgByQueue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] mqadmin printMsgByQueue stops scanning after an unmatched pull batch

2 participants