anuragp010 commented on code in PR #11917:
URL: https://github.com/apache/ozone/pull/11917#discussion_r4577953251


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/SCMCommonPlacementPolicy.java:
##########
@@ -418,6 +436,24 @@ public List<DatanodeDetails> getResultSet(
   public abstract DatanodeDetails chooseNode(
       List<DatanodeDetails> healthyNodes);
 
+  /**
+   * Choose a datanode according to the policy, ranking candidates by their 
usage
+   * of the given storage type.

Review Comment:
   Nit: the first sentence says this "ranks candidates by their usage of the 
given storage type", but this default implementation ignores storageType and 
just calls chooseNode(healthyNodes). The next paragraph says that, but the 
summary line reads as if the default does the ranking.
   
   Should we rephrase it?



##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/placement/algorithms/SCMContainerPlacementRandom.java:
##########
@@ -91,7 +91,9 @@ protected List<DatanodeDetails> chooseDatanodesInternal(
     if (healthyNodes.size() == nodesRequired) {
       return healthyNodes;
     }
-    return getResultSet(nodesRequired, healthyNodes);
+    // Selection is random, so storageType does not affect ranking here; the
+    // healthy node list is already filtered to it.
+    return getResultSet(nodesRequired, healthyNodes, storageType);

Review Comment:
   Just curious: what is the reason for passing `storageType` to `getResultSet` 
here?
   
   `SCMContainerPlacementRandom` picks via the `chooseNode(nodes, storageType)` 
 from `SCMCommonPlacementPolicy` which ignores the type. So it ends in the same 
random pick as the 2-arg `getResultSet(nodesRequired, healthyNodes)`, which 
already forwards null. The comment above the call also says the type does not 
affect ranking here.
   
   Is the intent that, if `getResultSet` in `SCMCommonPlacementPolicy` later 
starts using `storageType`, every placement policy gets it without another 
edit? 
   
   Note: Similar question in `PipelinePlacementPolicy`.



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