horizonzy commented on code in PR #3359:
URL: https://github.com/apache/bookkeeper/pull/3359#discussion_r914469658


##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/client/TopologyAwareEnsemblePlacementPolicy.java:
##########
@@ -790,6 +794,113 @@ public void updateBookieInfo(Map<BookieId, BookieInfo> 
bookieInfoMap) {
         }
     }
 
+    @Override
+    public Map<Integer, BookieId> 
replaceNotAdheringPlacementPolicyBookie(List<BookieId> ensemble, int 
writeQuorumSize,
+            int ackQuorumSize) {
+        if (CollectionUtils.isEmpty(ensemble)) {
+            return Collections.emptyMap();
+        }
+        PlacementPolicyAdherence ensembleAdheringToPlacementPolicy = 
isEnsembleAdheringToPlacementPolicy(ensemble,
+                writeQuorumSize, ackQuorumSize);
+        if (PlacementPolicyAdherence.FAIL != 
ensembleAdheringToPlacementPolicy) {
+            return Collections.emptyMap();
+        }
+        Map<BookieId, Integer> bookieIndex = new HashMap<>();
+        for (int i = 0; i < ensemble.size(); i++) {
+            bookieIndex.put(ensemble.get(i), i);
+        }
+
+        Map<BookieId, BookieNode> clone = new HashMap<>(knownBookies);
+
+        Map<String, List<BookieNode>> toPlaceGroup = new HashMap<>();
+        for (BookieId bookieId : ensemble) {
+            //If the bookieId shutdown, put it to inactive.
+            BookieNode bookieNode = clone.get(bookieId);

Review Comment:
   In theory, If the the fragment is DATA_LOSS, it won't invoke this method. It 
will repair data loss firstly.  
   But the bookie maybe shutdown after ledger check, so here replace the 
shutdown bookie firstlt



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

Reply via email to