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



##########
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:
       @symious Ah, that's a good point, thanks~ 
   I've updated a new version.




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