You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by sh...@apache.org on 2024/06/08 03:15:11 UTC

(bookkeeper) 01/02: [fix] fix Auditor ignoring bookies shut down before Auditor start (#4419)

This is an automated email from the ASF dual-hosted git repository.

shoothzj pushed a commit to branch branch-4.17
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git

commit 0acf4ce53dcc59bd7e67209e6a43d74b31cb59b6
Author: Andrey Yegorov <86...@users.noreply.github.com>
AuthorDate: Wed Jun 5 07:57:32 2024 -0700

    [fix] fix Auditor ignoring bookies shut down before Auditor start (#4419)
    
    (cherry picked from commit 896137d6fbd005d6eaf000af2820f1746d5daf45)
---
 .../src/main/java/org/apache/bookkeeper/replication/Auditor.java  | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/Auditor.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/Auditor.java
index 13b10cf927..66328e2597 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/Auditor.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/Auditor.java
@@ -36,6 +36,7 @@ import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.function.BiConsumer;
+import java.util.stream.Collectors;
 import org.apache.bookkeeper.client.BKException;
 import org.apache.bookkeeper.client.BookKeeper;
 import org.apache.bookkeeper.client.BookKeeperAdmin;
@@ -386,7 +387,12 @@ public class Auditor implements AutoCloseable {
 
             try {
                 watchBookieChanges();
-                knownBookies = getAvailableBookies();
+                // Start with all available bookies
+                // to handle situations where the auditor
+                // is started after some bookies have already failed
+                knownBookies = admin.getAllBookies().stream()
+                        .map(BookieId::toString)
+                        .collect(Collectors.toList());
                 this.ledgerUnderreplicationManager
                         .notifyLostBookieRecoveryDelayChanged(new LostBookieRecoveryDelayChangedCb());
             } catch (BKException bke) {