symious commented on a change in pull request #3190:
URL: https://github.com/apache/ozone/pull/3190#discussion_r827600510



##########
File path: 
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/placement/algorithms/SCMContainerPlacementRackScatter.java
##########
@@ -99,11 +98,15 @@ public SCMContainerPlacementRackScatter(final NodeManager 
nodeManager,
       throws SCMException {
     Preconditions.checkArgument(nodesRequired > 0);
     metrics.incrDatanodeRequestCount(nodesRequired);
-    int datanodeCount = networkTopology.getNumOfLeafNode(NetConstants.ROOT);
     int excludedNodesCount = excludedNodes == null ? 0 : excludedNodes.size();
-    if (datanodeCount < nodesRequired + excludedNodesCount) {
+    List<Node> totalNodes = networkTopology.getNodes(
+        networkTopology.getMaxLevel());
+    if (excludedNodes != null) {
+      totalNodes.removeAll(excludedNodes);
+    }
+    if (totalNodes.size() < nodesRequired) {
       throw new SCMException("No enough datanodes to choose. " +
-          "TotalNode = " + datanodeCount +
+          "TotalNode = " + totalNodes.size() +
           " RequiredNode = " + nodesRequired +
           " ExcludedNode = " + excludedNodesCount, null);

Review comment:
       How about add a new variable named totalNodeAfterExclude or 
availableNode?
   If SCM has 10 nodes and user excluded 2 nodes, the error message would show 
the total node be 8, not equal to the current number SCM recognize.




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