You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by GitBox <gi...@apache.org> on 2022/12/30 07:00:01 UTC

[GitHub] [bookkeeper] StevenLuMT commented on a diff in pull request #3723: Fix new ensemble sometimes failed problem.

StevenLuMT commented on code in PR #3723:
URL: https://github.com/apache/bookkeeper/pull/3723#discussion_r1059266229


##########
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:
   Do you need to set the length of the list in advance?



-- 
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: commits-unsubscribe@bookkeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org