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 2023/01/03 07:17:57 UTC

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

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

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