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 06:12:22 UTC

[GitHub] [iotdb] 23931017wu opened a new pull request, #6944: [IOTDB-4045] Optimize DataNode query relevant interfaces

23931017wu opened a new pull request, #6944:
URL: https://github.com/apache/iotdb/pull/6944

   
   ### remove the input parameter of getRegisteredDataNodes and getRegisteredDataNodeInfoList since we always query the registered DataNodes at the same time, just like query registered ConfigNodes.


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


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

Posted by GitBox <gi...@apache.org>.
RYH61 commented on code in PR #6944:
URL: https://github.com/apache/iotdb/pull/6944#discussion_r942225220


##########
confignode/src/main/java/org/apache/iotdb/confignode/manager/NodeManager.java:
##########
@@ -365,7 +365,13 @@ private TSStatus transferLeader(
 
   public List<TSStatus> merge(TMergeReq req) {
     Map<Integer, TDataNodeLocation> dataNodeLocationMap =
-        configManager.getNodeManager().getRegisteredDataNodeLocations(req.dataNodeId);
+        configManager.getNodeManager().getRegisteredDataNodeLocations();
+    if (req.dataNodeId != -1) {
+      dataNodeLocationMap =
+          dataNodeLocationMap.entrySet().stream()
+              .filter((e) -> 1 == e.getKey())

Review Comment:
   ```suggestion
                 .filter((e) -> req.dataNodeId == e.getKey())
   ```



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


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

Posted by GitBox <gi...@apache.org>.
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


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

Posted by GitBox <gi...@apache.org>.
RYH61 commented on code in PR #6944:
URL: https://github.com/apache/iotdb/pull/6944#discussion_r942226615


##########
confignode/src/main/java/org/apache/iotdb/confignode/manager/NodeManager.java:
##########
@@ -387,7 +399,13 @@ public List<TSStatus> flush(TFlushReq req) {
 
   public List<TSStatus> clearCache(TClearCacheReq req) {
     Map<Integer, TDataNodeLocation> dataNodeLocationMap =
-        configManager.getNodeManager().getRegisteredDataNodeLocations(req.dataNodeId);
+        configManager.getNodeManager().getRegisteredDataNodeLocations();
+    if (req.dataNodeId != -1) {
+      dataNodeLocationMap =
+          dataNodeLocationMap.entrySet().stream()
+              .filter((e) -> 1 == e.getKey())

Review Comment:
   ```suggestion
                 .filter((e) -> req.dataNodeId == e.getKey())
   ```



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


[GitHub] [iotdb] neuyilan merged pull request #6944: [IOTDB-4045] Optimize DataNode query relevant interfaces

Posted by GitBox <gi...@apache.org>.
neuyilan merged PR #6944:
URL: https://github.com/apache/iotdb/pull/6944


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


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

Posted by GitBox <gi...@apache.org>.
CRZbulabula commented on code in PR #6944:
URL: https://github.com/apache/iotdb/pull/6944#discussion_r942112312


##########
confignode/src/main/java/org/apache/iotdb/confignode/manager/NodeManager.java:
##########
@@ -375,8 +387,13 @@ public List<TSStatus> merge(TMergeReq req) {
   }
 
   public List<TSStatus> flush(TFlushReq req) {
-    Map<Integer, TDataNodeLocation> dataNodeLocationMap =
-        configManager.getNodeManager().getRegisteredDataNodeLocations(req.dataNodeId);
+    Map<Integer, TDataNodeLocation> dataNodeLocationMap;
+    if (req.dataNodeId == -1) {

Review Comment:
   ```suggestion
       if (req.dataNodeId != -1) {
   ```



##########
confignode/src/main/java/org/apache/iotdb/confignode/manager/NodeManager.java:
##########
@@ -364,8 +371,13 @@ private TSStatus transferLeader(
   }
 
   public List<TSStatus> merge(TMergeReq req) {
-    Map<Integer, TDataNodeLocation> dataNodeLocationMap =
-        configManager.getNodeManager().getRegisteredDataNodeLocations(req.dataNodeId);
+    Map<Integer, TDataNodeLocation> dataNodeLocationMap;
+    if (req.dataNodeId == -1) {

Review Comment:
   ```suggestion
       if (req.dataNodeId != -1) {
   ```



##########
confignode/src/main/java/org/apache/iotdb/confignode/manager/NodeManager.java:
##########
@@ -386,8 +403,13 @@ public List<TSStatus> flush(TFlushReq req) {
   }
 
   public List<TSStatus> clearCache(TClearCacheReq req) {
-    Map<Integer, TDataNodeLocation> dataNodeLocationMap =
-        configManager.getNodeManager().getRegisteredDataNodeLocations(req.dataNodeId);
+    Map<Integer, TDataNodeLocation> dataNodeLocationMap;
+    if (req.dataNodeId == -1) {

Review Comment:
   ```suggestion
       if (req.dataNodeId != -1) {
   ```



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



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


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

Posted by GitBox <gi...@apache.org>.
RYH61 commented on code in PR #6944:
URL: https://github.com/apache/iotdb/pull/6944#discussion_r942226446


##########
confignode/src/main/java/org/apache/iotdb/confignode/manager/NodeManager.java:
##########
@@ -376,7 +382,13 @@ public List<TSStatus> merge(TMergeReq req) {
 
   public List<TSStatus> flush(TFlushReq req) {
     Map<Integer, TDataNodeLocation> dataNodeLocationMap =
-        configManager.getNodeManager().getRegisteredDataNodeLocations(req.dataNodeId);
+        configManager.getNodeManager().getRegisteredDataNodeLocations();
+    if (req.dataNodeId != -1) {
+      dataNodeLocationMap =
+          dataNodeLocationMap.entrySet().stream()
+              .filter((e) -> 1 == e.getKey())

Review Comment:
   ```suggestion
                 .filter((e) -> req.dataNodeId == e.getKey())
   ```



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