lucaspeng12138 commented on code in PR #6184:
URL: https://github.com/apache/inlong/pull/6184#discussion_r997697217


##########
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/core/heartbeat/HeartbeatManager.java:
##########
@@ -97,26 +99,35 @@ public void reportHeartbeat(HeartbeatMsg heartbeat) {
 
         // if the heartbeat was not in the cache, insert or update the node by 
the heartbeat info
         HeartbeatMsg lastHeartbeat = 
heartbeatCache.getIfPresent(componentHeartbeat);
-        boolean exist = true;
-        int updateNum = UPDATE_ZERO_ROW;
-        if (lastHeartbeat == null) {
-            exist = false;
-            InlongClusterNodeEntity clusterNode = getClusterNode(clusterInfo, 
heartbeat);
-            if (clusterNode == null) {
-                updateNum = insertClusterNode(clusterInfo, heartbeat, 
clusterInfo.getCreator());
-                log.info("insert node result: {}", updateNum);
-            } else {
-                updateNum = updateClusterNode(clusterNode);
-                log.info("update node result: {}", updateNum);
+        String[] ports = heartbeat.getPort().split(InlongConstants.COMMA);
+        String protocolType = heartbeat.getProtocolType();
+        String[] protocolTypes = StringUtils.isNoneBlank(protocolType) && 
ports.length > 1
+                ? heartbeat.getProtocolType().split(InlongConstants.COMMA) : 
null;
+        for (int i = 0; i < ports.length; i++) {
+            HeartbeatMsg heartbeatMsg = OBJECT_MAPPER.readValue(
+                    OBJECT_MAPPER.writeValueAsBytes(heartbeat), 
HeartbeatMsg.class);
+            heartbeatMsg.setPort(ports[i].trim());
+            heartbeatMsg.setProtocolType(protocolType);
+            if (protocolTypes != null) {
+                heartbeatMsg.setProtocolType(protocolTypes[i]);
+            }
+            if (lastHeartbeat == null) {
+                InlongClusterNodeEntity clusterNode = 
getClusterNode(clusterInfo, heartbeatMsg);
+                if (clusterNode == null) {
+                    insertClusterNode(clusterInfo, heartbeatMsg, 
clusterInfo.getCreator());
+                } else {
+                    updateClusterNode(clusterNode);

Review Comment:
   May cause this bug happens, https://github.com/apache/inlong/issues/6159. 
Please add judgment for MySql IO return.



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