You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@bookkeeper.apache.org by GitBox <gi...@apache.org> on 2018/01/17 21:41:46 UTC

[GitHub] reddycharan commented on a change in pull request #979: ISSUE #978: decouple metaformat cmd

reddycharan commented on a change in pull request #979: ISSUE #978: decouple metaformat cmd
URL: https://github.com/apache/bookkeeper/pull/979#discussion_r162187522
 
 

 ##########
 File path: bookkeeper-server/src/main/java/org/apache/bookkeeper/discover/ZKRegistrationManager.java
 ##########
 @@ -421,94 +436,187 @@ public LayoutManager getLayoutManager(){
     }
 
     @Override
-    public boolean prepareFormat(ServerConfiguration conf) throws Exception {
-        try (ZooKeeper zk = ZooKeeperClient.newBuilder()
-            .connectString(conf.getZkServers())
-            .sessionTimeoutMs(conf.getZkTimeout())
-            .build()) {
-            boolean ledgerRootExists = null != zk.exists(
-                conf.getZkLedgersRootPath(), false);
-            boolean availableNodeExists = null != zk.exists(
-                conf.getZkAvailableBookiesPath(), false);
-            List<ACL> zkAcls = ZkUtils.getACLs(conf);
-            // Create ledgers root node if not exists
-            if (!ledgerRootExists) {
-                zk.create(conf.getZkLedgersRootPath(), "".getBytes(Charsets.UTF_8),
-                    zkAcls, CreateMode.PERSISTENT);
-            }
-            // create available bookies node if not exists
-            if (!availableNodeExists) {
-                zk.create(conf.getZkAvailableBookiesPath(), "".getBytes(Charsets.UTF_8),
-                    zkAcls, CreateMode.PERSISTENT);
+    public boolean prepareFormat() throws Exception {
+        boolean ledgerRootExists = null != zk.exists(conf.getZkLedgersRootPath(), false);
+        boolean availableNodeExists = null != zk.exists(conf.getZkAvailableBookiesPath(), false);
+        List<ACL> zkAcls = ZkUtils.getACLs(conf);
+        // Create ledgers root node if not exists
+        if (!ledgerRootExists) {
+            zk.create(conf.getZkLedgersRootPath(), "".getBytes(Charsets.UTF_8), zkAcls, CreateMode.PERSISTENT);
 
 Review comment:
   I didnt touch the implementation logic of this method, I just removed method arg for this method and try block.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services