Skip to content

mqadmin commands misorder large counters and timestamps - #11222

Closed
Metastarx wants to merge 1 commit into
apache:developfrom
Metastarx:patch/mqadmin-commands-misorder-large-counters
Closed

Metastarx wants to merge 1 commit into
apache:developfrom
Metastarx:patch/mqadmin-commands-misorder-large-counters

Conversation

@Metastarx

Copy link
Copy Markdown

Which Issue(s) This PR Fixes

#10850

Brief Description

Description

Several mqadmin comparators subtract long values and cast the result to int. Consumer lag, tag counts, and message store timestamps can therefore be ordered incorrectly once their difference exceeds the int range.

Affected commands include consumerProgress, printMessageByQueue, and queryMsgByUniqueKey.

Expected behavior

Use overflow-safe long comparison so command output remains correctly ordered for large values.

How Did You Test This Change?

PASSED: wsl -e bash scripts/gate-rocketmq.sh

补充说明

背景

Description

Several mqadmin comparators subtract long values and cast the result to int. Consumer lag, tag counts, and message store timestamps can therefore be ordered incorrectly once their difference exceeds the int range.

Affected commands include consumerProgress, printMessageByQueue, and queryMsgByUniqueKey.

Expected behavior

Use overflow-safe long comparison so command output remains correctly ordered for large values.

相关 Issue:#10850

变更内容

.../consumer/ConsumerProgressSubCommand.java       |  7 +-
 .../message/PrintMessageByQueueCommand.java        |  6 +-
 .../message/QueryMsgByUniqueKeySubCommand.java     | 13 ++-
 .../consumer/ConsumerProgressSubCommandTest.java   | 97 ++++++++++++++++++++++
 .../message/QueryMsgByUniqueKeySubCommandTest.java | 71 ++++++++++++++++
 5 files changed, 191 insertions(+), 3 deletions(-)
tools/src/test/java/org/apache/rocketmq/tools/command/message/PrintMessageByQueueCommandTest.java | 110 +++++++++

验证

PASSED: wsl -e bash scripts/gate-rocketmq.sh

检查清单

  • 未运行本地测试(以仓库 CI 为准)
  • 变更最小且不包含无关文件
  • 已遵守仓库贡献规范

Copilot AI lite review requested due to automatic review settings September 24, 2026 11:45

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@Metastarx

Copy link
Copy Markdown
Author

Thanks for the queue time, but I'm closing this in favor of #11202, which was opened two days earlier and addresses the same overflow issue. No point making the maintainers review the same fix twice.

@Metastarx Metastarx closed this Sep 24, 2026
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.

mqadmin commands misorder large counters and timestamps

2 participants