iloveeyjafjalla opened a new issue, #11385: URL: https://github.com/apache/rocketmq/issues/11385
### 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 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: ```java 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 1. `mqadmin updateBrokerConfig -c <cluster> -a false -k <key> -v <value> -n <namesrv>`. 2. 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 says `false`). ### 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. -- 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]
