ashishkumar50 commented on code in PR #4614:
URL: https://github.com/apache/ozone/pull/4614#discussion_r1179477629


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/placement/algorithms/SCMContainerPlacementRackAware.java:
##########
@@ -248,17 +434,34 @@ public DatanodeDetails chooseNode(List<DatanodeDetails> 
healthyNodes) {
    * @param excludedNodes - list of the datanodes to excluded. Can be null.
    * @param affinityNodes - the chosen nodes should be on the same rack as
    *                    affinityNodes. Can be null.
+   * @param usedNodes - the chosen nodes should be on the different rack
+   *                    than usedNodes rack when affinityNode is null.
    * @param dataSizeRequired - size required for the container.
    * @param metadataSizeRequired - size required for Ratis metadata.
    * @return List of chosen datanodes.
    * @throws SCMException  SCMException
    */
   private DatanodeDetails chooseNode(List<DatanodeDetails> excludedNodes,
-      List<DatanodeDetails> affinityNodes, long metadataSizeRequired,
+      List<DatanodeDetails> affinityNodes, List<DatanodeDetails> usedNodes,
+      long metadataSizeRequired,
       long dataSizeRequired) throws SCMException {
     int ancestorGen = RACK_LEVEL;
     int maxRetry = MAX_RETRY;
     List<String> excludedNodesForCapacity = null;
+
+    // When affinity node is null, in this case new node to be selected
+    // should be in different rack than used nodes rack.
+    // Exclude nodes should be just excluded from topology node selection,
+    // which is filled in excludedNodesForCapacity
+    // Used node rack should not be part of rack selection
+    // which is filled in excludedNodes

Review Comment:
   You can look into java doc of getLeaf(....) which has more detail about 
excludedScope and excludedNode.
     public Node getLeaf(int leafIndex, List<String> excludedScopes,
         Collection<Node> excludedNodes, int ancestorGen) {
   
   - excludedNodes-> If affinityNodes are null, and there are excluded nodes, 
then with ancestorGen=1 the selected nodes cannot share a rack with any nodes 
listed in excludedNodes.
   
   - excludedScopes -> Just exclude nodes from selection and not relates to 
rack.



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