You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@bookkeeper.apache.org by GitBox <gi...@apache.org> on 2022/07/26 04:08:17 UTC

[GitHub] [bookkeeper] hangc0276 commented on a diff in pull request #3339: [improve] decommissionBookie waiting for ledgers to be replicated back off policy

hangc0276 commented on code in PR #3339:
URL: https://github.com/apache/bookkeeper/pull/3339#discussion_r929505521


##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/client/BookKeeperAdmin.java:
##########
@@ -1622,13 +1622,33 @@ private void waitForLedgersToBeReplicated(Collection<Long> ledgers, BookieId thi
             LedgerManager ledgerManager) throws InterruptedException, TimeoutException {
         int maxSleepTimeInBetweenChecks = 10 * 60 * 1000; // 10 minutes
         int sleepTimePerLedger = 10 * 1000; // 10 secs
+        int rereplicateBackoffMs = 10 * 1000; // 10 secs
+        int backOffCount = 0;
         Predicate<Long> validateBookieIsNotPartOfEnsemble = ledgerId -> !areEntriesOfLedgerStoredInTheBookie(ledgerId,
                 thisBookieAddress, ledgerManager);
         while (!ledgers.isEmpty()) {
             LOG.info("Count of Ledgers which need to be rereplicated: {}", ledgers.size());
             int sleepTimeForThisCheck = (long) ledgers.size() * sleepTimePerLedger > maxSleepTimeInBetweenChecks
                     ? maxSleepTimeInBetweenChecks : ledgers.size() * sleepTimePerLedger;
-            Thread.sleep(sleepTimeForThisCheck);
+            long nextValidateTime = System.currentTimeMillis() + sleepTimeForThisCheck;

Review Comment:
   Could you use a backoff policy to simplify the code?  You can refer to: https://github.com/apache/pulsar/blob/master/pulsar-client/src/main/java/org/apache/pulsar/client/impl/Backoff.java



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

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