You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by ch...@apache.org on 2022/07/27 15:52:17 UTC

[bookkeeper] branch master updated: [improve][client] release the bookie from QuarantinedBookies when health check is disabled (#3349)

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

chenhang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git


The following commit(s) were added to refs/heads/master by this push:
     new e345321cef [improve][client] release the bookie from QuarantinedBookies when health check is disabled (#3349)
e345321cef is described below

commit e345321cef263c078cd48ee3a23043f3f4e80833
Author: lixinyang <84...@users.noreply.github.com>
AuthorDate: Wed Jul 27 23:52:10 2022 +0800

    [improve][client] release the bookie from QuarantinedBookies when health check is disabled (#3349)
    
    ### Motivation
    we need release all quarantined bookies when we use the dynamic config to disable the health check. In some case, we disable the health check when the client has add all bookies to `quarantinedBookies`, then we want to recovery all client's read/write capability immediately.
    But now we need wait `BOOKIE_QUARANTINE_TIME_SECONDS` reached or we need restart all client, it's too slowly to recovery the client read/write for us.
    
    ### Changes
    Release all `QuarantinedBookies`,  after we dynamic disable the  health check.
---
 .../src/main/java/org/apache/bookkeeper/client/BookKeeper.java       | 1 +
 .../src/main/java/org/apache/bookkeeper/client/BookieWatcher.java    | 5 +++++
 .../main/java/org/apache/bookkeeper/client/BookieWatcherImpl.java    | 5 ++++-
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/BookKeeper.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/BookKeeper.java
index f08f47b98c..c7a544b8eb 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/BookKeeper.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/BookKeeper.java
@@ -632,6 +632,7 @@ public class BookKeeper implements org.apache.bookkeeper.client.api.BookKeeper {
         }
         if (!isEnabled) {
             LOG.info("Health checks is currently disabled!");
+            bookieWatcher.releaseAllQuarantinedBookies();
             return;
         }
 
diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/BookieWatcher.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/BookieWatcher.java
index fffe3eb506..abe896d012 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/BookieWatcher.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/BookieWatcher.java
@@ -78,4 +78,9 @@ public interface BookieWatcher {
      * @param bookie
      */
     void quarantineBookie(BookieId bookie);
+
+    /**
+     * Release all quarantined bookies, let it can be chosen for new ensembles.
+     */
+    void releaseAllQuarantinedBookies();
 }
diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/BookieWatcherImpl.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/BookieWatcherImpl.java
index 90d4f90145..8a9c56e862 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/BookieWatcherImpl.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/BookieWatcherImpl.java
@@ -359,5 +359,8 @@ class BookieWatcherImpl implements BookieWatcher {
         }
     }
 
-
+    @Override
+    public void releaseAllQuarantinedBookies(){
+        quarantinedBookies.invalidateAll();
+    }
 }