[Bug] mqadmin updateBrokerConfig -a false updates the slaves anyway
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 25/100
Research direction
The option parsing lives in the updateBrokerConfig subcommand of the tools module, where the a option is declared and checked with hasOption before choosing between the master-only and master-plus-slave address lists. Read how the argument value is obtained there and how the two CommandUtil fetch helpers are used. Done means -a false and a missing -a reach only masters, while -a true still reaches slaves; the mock-broker test that counts UPDATE_BROKER_CONFIG requests should confirm it. Pull request #11386 already targets this, so check it before starting.
Written by the indexing model from the issue text.
Description
Before Creating the Bug Report
- I found a bug, not just asking a question, which should be created in GitHub Discussions.
- I have searched the GitHub Issues and GitHub Discussions of this repository and believe that this is not a duplicate.
- I have confirmed that this bug belongs to the current repository, not other repositories of RocketMQ.
Runtime platform environment
OS: any (mqadmin, tools module)
RocketMQ version
branch: develop
Git commit id: 9ea2ccdc2b41445aee5e177e14e501d606f5a1ed (the command is unchanged on develop@b76420599)
JDK Version
Compiler: Temurin 1.8.0_504 (target 1.8, same as CI)
Describe the Bug
mqadmin updateBrokerConfig -a false updates the slaves anyway.
The option is declared with the boolean as its argument, and the help says so:
opt = new Option("a", "updateAllBroker", true, "update all brokers include slave");
...
if (commandLine.hasOption('a')) {
brokerAddrSet = CommandUtil.fetchMasterAndSlaveAddrByClusterName(defaultMQAdminExt, clusterName);
} else {
brokerAddrSet = CommandUtil.fetchMasterAddrByClusterName(defaultMQAdminExt, clusterName);
}
getOptionValue('a') is never called, so any presence of the option — including the explicit -a false that the help's
<arg> invites — selects the master+slave fan-out. A user who wants to touch only the masters but spells the flag out gets
every broker in the cluster updated, which for role-sensitive keys (e.g. anything read at startup) means the slaves are
configured differently from what the operator asked for. Because the option requires an argument, there is also no way to ask
for "masters only" by writing the flag alone.
Steps to Reproduce
mqadmin updateBrokerConfig -c <cluster> -a false -k <key> -v <value> -n <namesrv>.- The UPDATE_BROKER_CONFIG request is sent to the slaves of the cluster as well (see the test below, which counts the
requests each mock broker received: the slave receives one although the flag saysfalse).
Expected behavior
-a false (and a missing -a) update the masters only; -a true updates the masters and the slaves, as the help text
describes.
Actual behavior
-a false behaves like -a/-a true: every broker of the cluster is updated.
Additional context
Fix: read the option's argument (Boolean.parseBoolean(commandLine.getOptionValue('a'))) instead of treating the option as a
switch. No documentation or script in the repository passes a bare -a, so the strict true|false argument stays as
documented.
- Dominant language
- Java
- Stars
- 22.7k
- Forks
- 12k
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 17
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apache/rocketmq
-
[Bug] RemotingHelper.connect swaps the socket send and receive buffer configurationPossibly taken @amalsaidov claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
CompressionType.of fails under the Turkish localePossibly taken @sharanggupta claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
Maintainers usually reply within 1 day
-
[rocketmq-client-python] TransactionMQProducer allocates an unused producer during initializationOpen
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
[Bug] notifyMasterOnline aborts the long-polling wake-up with a NullPointerException when an arrival drains a bucket firstPossibly taken @iloveeyjafjalla claimed this 29 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
apache/rocketmq#11441 · 1 comment ·
Maintainers usually reply within 1 day
-
[Enhancement] FilterFactory duplicate-registration and unregister semantics lack testsPossibly taken @chennaji9 claimed this 34 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
apache/rocketmq#11340 · 2 comments ·
Maintainers usually reply within 1 day
Similar issues
-
bug emitter:client:csharp
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
microsoft/typespec#12572 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
GCC 15.2: -Wcast-qual warning - cast discards const qualifier from pointer target type (H5trace.c)Open
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
Maintainers usually reply within 1 day
-
needs-area-label
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 2 days
-
area/ai area/backend component/zeebe kind/task
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
spAnser/reacharound#38 ·