Radiancebobo commented on code in PR #4873:
URL: https://github.com/apache/bookkeeper/pull/4873#discussion_r4754360174


##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/ReplicationWorker.java:
##########
@@ -441,78 +455,91 @@ private Set<LedgerFragment> 
getNeedRepairedPlacementNotAdheringFragments(LedgerH
     }
 
     @SuppressFBWarnings("RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE")
-    private boolean rereplicate(long ledgerIdToReplicate) throws 
InterruptedException, BKException,
+    private RereplicateResult rereplicate(long ledgerIdToReplicate) throws 
InterruptedException, BKException,
             UnavailableException {
         log.debug().attr("ledgerId", ledgerIdToReplicate).log("Going to 
replicate the fragments of the ledger");
 
         boolean deferLedgerLockRelease = false;
 
-        try (LedgerHandle lh = 
admin.openLedgerNoRecovery(ledgerIdToReplicate)) {
-            Set<LedgerFragment> fragments = getUnderreplicatedFragments(lh,
-                    conf.getAuditorLedgerVerificationPercentage());
+        try {
+            if (skipHistoricalSingleReplicaLedger(ledgerIdToReplicate)) {

Review Comment:
   I agree that the extra lookup adds ZooKeeper work. However, opening first 
would prevent cleanup of an unclosed single-replica ledger whose sole bookie is 
unavailable: `openLedgerNoRecovery` still reads LAC for unclosed ledgers and 
can fail before reaching the skip guard.
   
   I’ve retained the metadata-only precheck, bounded its metadata wait with 
zkTimeout, and added an integration test for this case. The test verifies that 
the historical task is cleared, its lock is released, and the ledger metadata 
remains OPEN.



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