xinglin commented on code in PR #5778:
URL: https://github.com/apache/hadoop/pull/5778#discussion_r1241497840


##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockPlacementPolicyDefault.java:
##########
@@ -1236,11 +1245,17 @@ public DatanodeStorageInfo chooseReplicaToDelete(
         minSpace = free;
         minSpaceStorage = storage;
       }
+      if (considerLoad2chooseReplicaDeleting && nodeLoad < minLoad) {
+        minLoad = nodeLoad;
+        minLoadStorage = storage;
+      }
     }
 
     final DatanodeStorageInfo storage;
     if (oldestHeartbeatStorage != null) {

Review Comment:
   this `if else` code section seems problematic: After exiting from the 
previous for loop, minSpaceStorage should not be null because minSpace is 
initialized to Long.MAX_VALUE. So, `storage = minSpaceStorage;` will always be 
executed: it seems we are always picking a replica based on remaining space, 
rather than the other two metrics.



-- 
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: common-issues-unsubscr...@hadoop.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org

Reply via email to