sijie commented on a change in pull request #1027: ISSUE #1026: initbookie cmd
URL: https://github.com/apache/bookkeeper/pull/1027#discussion_r162799945
##########
File path:
bookkeeper-server/src/main/java/org/apache/bookkeeper/client/BookKeeperAdmin.java
##########
@@ -1154,6 +1159,73 @@ public static boolean format(ServerConfiguration conf,
}
}
+ /**
+ * Initializes bookie, by making sure that the journalDir, ledgerDirs and
+ * indexDirs are empty and there is no registered Bookie with this
BookieId.
+ *
+ * @param conf
+ * @return
+ * @throws Exception
+ */
+ public static boolean initBookie(ServerConfiguration conf) throws
Exception {
+ try (RegistrationManager rm =
RegistrationManager.instantiateRegistrationManager(conf)) {
Review comment:
RegistrationManager is only used after checking the directories. It would be
good to defer creating a RM until it is needed, so it doesn't have to create
zookeeper connection if there are non-empty directories exist.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services