You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2020/04/14 11:48:08 UTC

[GitHub] [hadoop-ozone] sodonnel commented on a change in pull request #668: HDDS-3139. Pipeline placement should max out pipeline usage

sodonnel commented on a change in pull request #668: HDDS-3139. Pipeline placement should max out pipeline usage
URL: https://github.com/apache/hadoop-ozone/pull/668#discussion_r408073953
 
 

 ##########
 File path: hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/PipelinePlacementPolicy.java
 ##########
 @@ -373,13 +354,31 @@ protected DatanodeDetails chooseNodeBasedOnRackAwareness(
       return null;
     }
 
-    for (DatanodeDetails node : healthyNodes) {
-      if (excludedNodes.contains(node) ||
-          anchor.getNetworkLocation().equals(node.getNetworkLocation())) {
-        continue;
-      } else {
-        return node;
-      }
+    List<DatanodeDetails> nodesOnOtherRack = healthyNodes.stream().filter(
+        p -> !excludedNodes.contains(p)
+            && !anchor.getNetworkLocation().equals(p.getNetworkLocation()))
+        .collect(Collectors.toList());
+    if (!nodesOnOtherRack.isEmpty()) {
+      return nodesOnOtherRack.get(0);
+    }
+    return null;
+  }
+
+  @VisibleForTesting
+  protected DatanodeDetails chooseNodeBasedOnSameRack(
+      List<DatanodeDetails> healthyNodes,  List<DatanodeDetails> excludedNodes,
+      NetworkTopology networkTopology, DatanodeDetails anchor) {
+    Preconditions.checkArgument(networkTopology != null);
+    if (checkAllNodesAreEqual(networkTopology)) {
+      return null;
+    }
+
+    List<DatanodeDetails> nodesOnOtherRack = healthyNodes.stream().filter(
 
 Review comment:
   Can you rename nodeOnOtherRack to nodesOnSameRack here please?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org