bookkeeper
bookkeeper copied to clipboard
Fix bookie process still alive when bookie startup is not successful and shutdown
Motivation
When bookie startup encounter IOException in BookieImpl#readJournal(), bookie startup is not successful and then trigger shutdown(). However, bookie process is still alive.
The reason is IOException is caught in BookieImpl and trigger shutdown. Bookie actually is not running. But the exception do not throw to startComponent.
So BookieServer.main / server.Main.doMain still wait for the startComponent future to complete.
The relevant code is as following:
https://github.com/apache/bookkeeper/blob/3221aa30924825cb4c1a5b00fb68dec44712946e/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BookieImpl.java#L654-L660
https://github.com/apache/bookkeeper/blob/3221aa30924825cb4c1a5b00fb68dec44712946e/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/BookieServer.java#L123-L131
https://github.com/apache/bookkeeper/blob/3221aa30924825cb4c1a5b00fb68dec44712946e/bookkeeper-common/src/main/java/org/apache/bookkeeper/common/component/ComponentStarter.java#L63-L87
Changes
throw exception to startComponent when bookie start encounter error.