horizonzy commented on code in PR #3723:
URL: https://github.com/apache/bookkeeper/pull/3723#discussion_r1060323355
##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/client/RackawareEnsemblePlacementPolicyImpl.java:
##########
@@ -678,6 +728,38 @@ protected BookieNode selectRandomFromRack(String netPath,
Set<Node> excludeBooki
throw new BKNotEnoughBookiesException();
}
+ /**
+ * Sort the node list by the network location.
+ * The higher the frequency of the network location, it will on the list
head.
+ */
+ private List<Node> sortByCommonRack(List<Node> nodeLists) {
+ Map<String, Integer> map = new HashMap<>();
+ for (Node node : nodeLists) {
+ map.put(node.getNetworkLocation(),
map.getOrDefault(node.getNetworkLocation(), 0) + 1);
+ }
+ List<Object[]> list = new ArrayList<>();
Review Comment:
The size is not unpredictable
--
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]