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 7614cd6bfdc2ea5a0a177c8087d61af6517593d8
Author: wenbingshen <[email protected]>
AuthorDate: Thu Feb 9 15:30:52 2023 +0800

    BookieImpl remove wait until journal quits (#3603)
    
    ### Motivation
    
    PR #2887 introduced the feature of shutdown the bookie service after any 
Journal thread exits, so we don't need to wait in BookieImpl for all Journal 
threads to exit before shutdown the Bookie service, because this cannot happen.
    
    (cherry picked from commit b85ac48e8b61748300206646ab9dd1fc16ed1616)
---
 .../org/apache/bookkeeper/bookie/BookieImpl.java   | 27 +++-------------------
 .../apache/bookkeeper/test/ReadOnlyBookieTest.java |  2 +-
 2 files changed, 4 insertions(+), 25 deletions(-)

diff --git 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BookieImpl.java 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BookieImpl.java
index 03cd6ad681..1d000ab53a 100644
--- 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BookieImpl.java
+++ 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BookieImpl.java
@@ -781,30 +781,9 @@ public class BookieImpl extends BookieCriticalThread 
implements Bookie {
 
     @Override
     public void run() {
-        // bookie thread wait for journal thread
-        try {
-            // start journals
-            for (Journal journal: journals) {
-                journal.start();
-            }
-
-            // wait until journal quits
-            for (Journal journal: journals) {
-
-                journal.joinThread();
-            }
-            LOG.info("Journal thread(s) quit.");
-        } catch (InterruptedException ie) {
-            Thread.currentThread().interrupt();
-            LOG.warn("Interrupted on running journal thread : ", ie);
-        }
-        // if the journal thread quits due to shutting down, it is ok
-        if (!stateManager.isShuttingDown()) {
-            // some error found in journal thread and it quits
-            // following add operations to it would hang unit client timeout
-            // so we should let bookie server exists
-            LOG.error("Journal manager quits unexpectedly.");
-            triggerBookieShutdown(ExitCode.BOOKIE_EXCEPTION);
+        // start journals
+        for (Journal journal: journals) {
+            journal.start();
         }
     }
 
diff --git 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/test/ReadOnlyBookieTest.java
 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/test/ReadOnlyBookieTest.java
index cf03cf6629..e8cdbd590d 100644
--- 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/test/ReadOnlyBookieTest.java
+++ 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/test/ReadOnlyBookieTest.java
@@ -231,7 +231,7 @@ public class ReadOnlyBookieTest extends 
BookKeeperClusterTestCase {
         assertEquals("writable dirs should have one dir", 1, ledgerDirsManager
                 .getWritableLedgerDirs().size());
         assertTrue("Bookie should shutdown if readOnlyMode not enabled",
-                bookie.isAlive());
+                bookie.isRunning());
     }
 
     private void startNewBookieWithMultipleLedgerDirs(int numOfLedgerDirs)

Reply via email to