You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2022/08/10 09:02:05 UTC

[GitHub] [iotdb] 23931017wu commented on a diff in pull request #6944: [IOTDB-4045] Optimize DataNode query relevant interfaces

23931017wu commented on code in PR #6944:
URL: https://github.com/apache/iotdb/pull/6944#discussion_r942205618


##########
confignode/src/main/java/org/apache/iotdb/confignode/manager/NodeManager.java:
##########
@@ -204,17 +204,24 @@ public int getTotalCpuCoreCount() {
    * Only leader use this interface
    *
    * @param dataNodeId Specific DataNodeId
-   * @return All registered DataNodes if dataNodeId equals -1. And return the specific DataNode
-   *     otherwise.
+   * @return All registered DataNodes
    */
-  public List<TDataNodeConfiguration> getRegisteredDataNodes(int dataNodeId) {
-    return nodeInfo.getRegisteredDataNodes(dataNodeId);
+  public List<TDataNodeConfiguration> getRegisteredDataNodes() {
+    return nodeInfo.getRegisteredDataNodes();
   }
 
-  public Map<Integer, TDataNodeLocation> getRegisteredDataNodeLocations(int dataNodeId) {
+  public Map<Integer, TDataNodeLocation> getRegisteredDataNodeLocationById(int dataNodeId) {
+    Map<Integer, TDataNodeLocation> dataNodeLocations = new ConcurrentHashMap<>();
+    dataNodeLocations.put(
+        nodeInfo.getRegisteredDataNodeById(dataNodeId).getLocation().getDataNodeId(),
+        nodeInfo.getRegisteredDataNodeById(dataNodeId).getLocation());
+    return dataNodeLocations;
+  }

Review Comment:
   > An interface that returns a map with only one element looks a little strange?
   Okay, I've modified it ~
   



-- 
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: reviews-unsubscribe@iotdb.apache.org

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