You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "mxsm (via GitHub)" <gi...@apache.org> on 2023/01/28 03:34:21 UTC

[GitHub] [rocketmq] mxsm commented on a diff in pull request #5930: [ISSUE #5929] Fix the issue that broker send heartbeat to controller frequently causing thread blocking when the network partition

mxsm commented on code in PR #5930:
URL: https://github.com/apache/rocketmq/pull/5930#discussion_r1089609548


##########
broker/src/main/java/org/apache/rocketmq/broker/controller/ReplicasManager.java:
##########
@@ -445,6 +457,35 @@ private void stopCheckSyncStateSet() {
         }
     }
 
+    private void scanAvailableControllerAddresses() {
+        if (controllerAddresses == null) {
+            LOGGER.warn("scanAvailableControllerAddresses addresses of controller is null!");
+            return;
+        }
+
+        for (String address : availableControllerAddresses.keySet()) {
+            if (!controllerAddresses.contains(address)) {
+                LOGGER.warn("scanAvailableControllerAddresses remove invalid address {}", address);
+                availableControllerAddresses.remove(address);
+            }
+        }
+
+        for (String address : controllerAddresses) {
+            scanExecutor.submit(new Runnable() {
+                @Override public void run() {
+                    if (brokerOuterAPI.checkAddressCanConnect(address)) {

Review Comment:
   code style
   ```
   @Override 
   public void run() {
   ```



##########
broker/src/main/java/org/apache/rocketmq/broker/controller/ReplicasManager.java:
##########
@@ -491,4 +532,8 @@ public List<String> getControllerAddresses() {
     public List<EpochEntry> getEpochEntries() {
         return this.haService.getEpochEntries();
     }
+
+    public List<String> getAvailableControllerAddresses() {
+        return new ArrayList<>(availableControllerAddresses.keySet());
+    }

Review Comment:
   How about set ArrayList initialCapacity to prevent expansion 



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