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

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

commit fcfbfe6b43810c29a9e4f726428bd12581e6c9f8
Author: lixinyang <[email protected]>
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.
    
    (cherry picked from commit e345321cef263c078cd48ee3a23043f3f4e80833)
---
 .../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 26b741b457..784a70a928 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();
+    }
 }

Reply via email to