Tang-Kin-Long opened a new issue, #11630:
URL: https://github.com/apache/rocketmq/issues/11630

   ### 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
   
   Ubuntu 24.04.4 LTS, x86_64
   
   ### RocketMQ version
   
   develop at e114b5426 (5.5.1)
   
   ### JDK Version
   
   OpenJDK 8u512
   
   ### Describe the Bug
   
   `mqadmin exportMetrics` writes the local mqadmin version to 
`runtimeVersion.rocketmqVersion` in each broker's entry in `metrics.json`. When 
a broker runs a different version from mqadmin, the exported report gives the 
wrong version for that broker. During a rolling upgrade, this can make brokers 
on different releases appear to be running the same version.
   
   ### Steps to Reproduce
   
   I reproduced this with a JUnit test using mocked broker responses and the 
actual `ExportMetricsCommand` export logic.
   1. Use `ExportMetricsCommand` from RocketMQ 5.5.1.
   2. Mock a cluster with two brokers. Have `fetchBrokerRuntimeStats` return 
`brokerVersionDesc = V5_3_2` for `broker-a` and `brokerVersionDesc = V5_4_0` 
for `broker-b`.
   3. Execute the command with `-c cluster -f <output-directory>`.
   4. Open the generated `metrics.json` and inspect 
`evaluateReport.broker-a.runtimeVersion.rocketmqVersion`
   
   ### What Did You Expect to See?
   
   The report should show `V5_3_2` for `broker-a` and `V5_4_0` for `broker-b`, 
matching the version each broker returned.
   
   ### What Did You See Instead?
   
   The export completed successfully, but the file contained `V5_5_1` for 
`broker-a`. The first assertion failed because the broker had reported `V5_3_2`.
   
   ### Additional Context
   
   `ExportMetricsCommand#getRuntimeVersion` populates `rocketmqVersion` from 
`MQVersion.CURRENT_VERSION` in the mqadmin process. The command already 
retrieves `brokerVersionDesc` for each broker through 
`fetchBrokerRuntimeStats`. Using that field made the same test pass for both 
brokers without an additional RPC.


-- 
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]

Reply via email to