tasanuma commented on a change in pull request #3704:
URL: https://github.com/apache/hadoop/pull/3704#discussion_r766860075



##########
File path: 
hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DataStreamer.java
##########
@@ -1188,6 +1198,43 @@ public void run() {
             }
           }
 
+          if (slowNodesFromAck.isEmpty()) {
+            if (!slowNodeMap.isEmpty()) {
+              slowNodeMap.clear();
+            }
+          } else {
+            Map<DatanodeInfo, Integer> newSlowNodeMap = new HashMap<>();
+            for (DatanodeInfo slowNode : slowNodesFromAck) {
+              if (!slowNodeMap.containsKey(slowNode)) {
+                newSlowNodeMap.put(slowNode, 1);
+              } else {
+                int oldCount = slowNodeMap.get(slowNode);
+                newSlowNodeMap.put(slowNode, ++oldCount);
+              }
+            }
+            slowNodeMap = newSlowNodeMap;

Review comment:
       Sorry, I didn't realize that `slowNodeMap` has discontinuous nodes, so 
my suggestion is wrong.
   
   > Could you help to check the implementation in 
https://github.com/symious/hadoop/commit/973af5e7a959f86f8b8807472a063c60193a2cdc
 ?
   
   It seems more readable than the previous one. Please use it. Thanks.




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



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to