healchow commented on code in PR #6221:
URL: https://github.com/apache/inlong/pull/6221#discussion_r1000094704


##########
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/cluster/InlongClusterServiceImpl.java:
##########
@@ -713,31 +748,17 @@ public DataProxyNodeResponse getDataProxyNodes(String 
inlongGroupId, String prot
             LOGGER.debug(msg);
             throw new BusinessException(msg);
         }
-
-        // if more than one data proxy cluster, currently takes first
-        // TODO consider the data proxy load and re-balance
-        List<DataProxyNodeInfo> nodeInfos = new ArrayList<>();
+        List<InlongClusterNodeEntity> nodeList = new ArrayList<>();
         for (InlongClusterEntity entity : clusterList) {
-            List<InlongClusterNodeEntity> nodeList = 
clusterNodeMapper.selectByParentId(entity.getId(), protocolType);
-            for (InlongClusterNodeEntity nodeEntity : nodeList) {
-                DataProxyNodeInfo nodeInfo = new DataProxyNodeInfo();
-                nodeInfo.setId(nodeEntity.getId());
-                nodeInfo.setIp(nodeEntity.getIp());
-                nodeInfo.setPort(nodeEntity.getPort());
-                nodeInfo.setProtocolType(nodeEntity.getProtocolType());
-                nodeInfos.add(nodeInfo);
+            List<InlongClusterNodeEntity> clusterDPList = clusterNodeMapper
+                    .selectByParentId(entity.getId(), protocolType);
+            if (CollectionUtils.isNotEmpty(clusterDPList)) {
+                nodeList.addAll(clusterDPList);
             }
         }
-
-        DataProxyNodeResponse response = new DataProxyNodeResponse();
-        response.setClusterId(clusterList.get(0).getId());
-        response.setNodeList(nodeInfos);
-
-        if (LOGGER.isDebugEnabled()) {
-            LOGGER.debug("success to get data proxy nodes for groupId={}, 
protocol={} result={}",
-                    inlongGroupId, protocolType, response);
-        }
-        return response;
+        Map<Integer, List<InlongClusterNodeEntity>> clusterDP = new 
HashMap<>();
+        clusterDP.put(clusterList.get(0).getId(), nodeList);

Review Comment:
   Why just put `clusterList.get(0).getId()`, not need another IDs from 
clusterList?



-- 
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-unsubscr...@inlong.apache.org

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

Reply via email to