Skip to content

Commit

Permalink
BookieImpl remove wait until journal quits (#3603)
Browse files Browse the repository at this point in the history
### 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.
  • Loading branch information
wenbingshen authored Feb 9, 2023
1 parent 4ca4b4e commit b85ac48
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -810,30 +810,9 @@ public boolean isRunning() {

@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();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ public void testBookieContinueWritingIfMultipleLedgersPresent()
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)
Expand Down

0 comments on commit b85ac48

Please sign in to comment.