TheR1sing3un commented on code in PR #5046:
URL: https://github.com/apache/rocketmq/pull/5046#discussion_r975311355


##########
controller/src/main/java/org/apache/rocketmq/controller/ControllerManager.java:
##########
@@ -141,32 +142,32 @@ private void onBrokerInactive(String clusterName, String 
brokerName, String brok
     /**
      * Notify master and all slaves for a broker that the master role changed.
      */
-    public void notifyBrokerRoleChanged(final ElectMasterResponseHeader 
electMasterResult, final String clusterName) {
-        final BrokerMemberGroup memberGroup = 
electMasterResult.getBrokerMemberGroup();
+    public void notifyBrokerRoleChanged(final RoleChangeNotifyEntry entry) {
+        final BrokerMemberGroup memberGroup = entry.getBrokerMemberGroup();
         if (memberGroup != null) {
             // First, inform the master
-            final String master = electMasterResult.getNewMasterAddress();
-            if (StringUtils.isNoneEmpty(master) && 
this.heartbeatManager.isBrokerActive(clusterName, master)) {
-                doNotifyBrokerRoleChanged(master, MixAll.MASTER_ID, 
electMasterResult);
+            final String master = entry.getMasterAddress();
+            if (StringUtils.isNoneEmpty(master) && 
this.heartbeatManager.isBrokerActive(memberGroup.getCluster(), master)) {
+                doNotifyBrokerRoleChanged(master, MixAll.MASTER_ID, entry);

Review Comment:
   Just do nothing because the 'master' can't be empty if the 'memberGroup' is 
not null. Maybe I should add a warning log if this case actually take place?



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