You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by GitBox <gi...@apache.org> on 2022/10/20 02:53:50 UTC

[GitHub] [inlong] healchow commented on a diff in pull request #6221: [INLONG-6220][Manager] Support query of DP cluster based on GroupId and protocol

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

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