You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "123123213weqw (via GitHub)" <gi...@apache.org> on 2026/10/09 06:14:58 UTC

[PR] fix(cluster): order discovered clusters by name [rocketmq-dashboard]

123123213weqw opened a new pull request, #5770:
URL: https://github.com/apache/rocketmq-dashboard/pull/5770

   ## What
   
   `RocketMQClusterProvider.discoverClustersAt` walks the NameServer's
   `clusterAddrTable` in its natural iteration order. That table is a `HashMap`
   deserialized from the remoting response, so its iteration order is hash-based
   and effectively random per snapshot: the cluster list returned for the same
   instance can reshuffle between two consecutive requests, which makes the
   console's cluster selector and any diffing consumer flicker.
   
   `RealClusterProvider.toClusterVOs` already sorts its table walk by cluster
   name; the instance-backed provider did not.
   
   ## Fix
   
   Sort the `clusterAddrTable` entries by key before building the `ClusterVO`
   list, so both providers return clusters in the same stable name order.
   
   ## Test
   
   `discoverClustersShouldOrderClustersByNameRegardlessOfTableOrder` feeds a
   table whose insertion order is deliberately reverse-alphabetical and asserts
   the discovered list is name-ordered. Red on the current code (returns the
   table's insertion order), green after the sort.


-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(cluster): order discovered clusters by name [rocketmq-dashboard]

Posted by "123123213weqw (via GitHub)" <gi...@apache.org>.
123123213weqw commented on PR #5770:
URL: https://github.com/apache/rocketmq-dashboard/pull/5770#issuecomment-6124391956

   Continued in #6388 with the review asks applied: `buildBrokerList` now walks a sorted copy too, the test carries the `Test` suffix, and the rationale is softened — branch merged onto the current `rocketmq-studio`.


-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(cluster): order discovered clusters by name [rocketmq-dashboard]

Posted by "lizhimins (via GitHub)" <gi...@apache.org>.
lizhimins commented on PR #5770:
URL: https://github.com/apache/rocketmq-dashboard/pull/5770#issuecomment-6094440611

   The ordering contract argument is valid — `RealClusterProvider` already sorts its table walk (`RealClusterProvider.java:133`) and this provider did not — but please soften the rationale: a `HashMap` iterates deterministically for an identical key set, so the list does not actually reshuffle between two requests of the same cluster; the real win is consistency with the sibling provider and predictable output. Two things before merge: (1) the same family is still unfixed one level down — `buildBrokerList` (line 219) walks `entry.getValue()`, a deserialized `HashSet`, so brokers inside each cluster remain hash-ordered while `RealClusterProvider.java:146` sorts them by name; please sort those too (or say why not); (2) rename the test to end with `Test` per repo convention. We would like to merge this together with #5771 so the cluster list and the dashboard overview agree.
   


-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(cluster): order discovered clusters by name [rocketmq-dashboard]

Posted by "lizhimins (via GitHub)" <gi...@apache.org>.
lizhimins closed pull request #5770: fix(cluster): order discovered clusters by name
URL: https://github.com/apache/rocketmq-dashboard/pull/5770


-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org