Skip to content

fix(tools): scope rocksDBConfigToJson rpc mode to the requested cluster - #11147

Open
zjncs wants to merge 1 commit into
apache:developfrom
zjncs:fix/rocksdb-config-rpc-cluster-scope
Open

zjncs wants to merge 1 commit into
apache:developfrom
zjncs:fix/rocksdb-config-rpc-cluster-scope

Conversation

@zjncs

@zjncs zjncs commented Sep 11, 2026

Copy link
Copy Markdown

Motivation

handleRpcMode of mqadmin rocksDBConfigToJson validated the -c cluster name but then walked the whole brokerAddrTable, so the export request was sent to the masters of every cluster instead of only the requested one. Brokers without a master resolved to a null address, which defaultMQAdminExtImpl silently routed through the name server channel.

Modifications

Iterate the brokers of the requested cluster and skip master-less brokers.

Verification

Fail-before (new test, run against the unpatched code):

RocksDBConfigToJsonRpcModeTest#testRpcModeOnlyExportsBrokersOfSpecifiedCluster
java.lang.RuntimeException: RocksDBConfigToJsonCommand command failed
  at RocksDBConfigToJsonCommand.handleRpcMode(RocksDBConfigToJsonCommand.java:280)
(export request hit a master-less broker outside the requested cluster)

Pass-after:

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 -- RocksDBConfigToJsonRpcModeTest

handleRpcMode validated the -c cluster name but then walked the whole
brokerAddrTable, so the export request was sent to masters of every
cluster, and brokers without a master resolved to a null address that
silently routed the request through the name server channel. Iterate the
brokers of the requested cluster and skip master-less brokers.
Copilot AI lite review requested due to automatic review settings September 11, 2026 07:14

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.

@RockteMQ-AI RockteMQ-AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Summary

Fix rocksDBConfigToJson in RPC mode to scope the operation to the requested cluster instead of iterating over all brokers. Also adds null guards for missing broker data and master addresses.

LGTM — correct scoping fix with comprehensive test (108 lines).


Automated review by github-manager-bot

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.

3 participants