yandrey321 commented on code in PR #12144:
URL: https://github.com/apache/ozone/pull/12144#discussion_r4675379564
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/placement/algorithms/SCMContainerPlacementRackScatter.java:
##########
@@ -333,9 +333,12 @@ protected List<DatanodeDetails> chooseDatanodesInternal(
}
if (chosenNodes.size() < nodesRequired) {
- racks.addAll(usedRacksCntMap.keySet());
+ // usedRacksCntMap iterates in the same order for the same racks, so
shuffle to spread extra replicas
+ List<Node> usedRacks = new ArrayList<>(usedRacksCntMap.keySet());
+ Collections.shuffle(usedRacks);
+ racks.addAll(usedRacks);
racks = sortRackWithExcludedNodes(racks, excludedNodes, usedRacksCntMap);
- racks.addAll(usedRacksCntMap.keySet());
+ racks.addAll(usedRacks);
Review Comment:
why do we need to add usedRacks second time here?
--
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]