This is an automated email from the ASF dual-hosted git repository.

ivank pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git


The following commit(s) were added to refs/heads/master by this push:
     new 4fe3534  ISSUE #1927: fix NoNodeException in LocalBookeeper
4fe3534 is described below

commit 4fe353425ef6e6df1a04cd1be541139881abae9b
Author: zhaohaidao <[email protected]>
AuthorDate: Thu Jun 6 15:31:27 2019 +0800

    ISSUE #1927: fix NoNodeException in LocalBookeeper
    
    ### Motivation
    It addresses #1927 where it provides a conf check at the beginning of 
startLocalBookiesInternal function.
    ### Changes
    
    - Add a conf check at the beginning of startLocalBookiesInternal function 
where non-default zkLedgersRootPath is not allowed.
    
    cc sijie
    
    Reviewers: Ivan Kelly <[email protected]>, Enrico Olivelli 
<[email protected]>, Sijie Guo <[email protected]>
    
    This closes #2082 from zhaohaidao/master, closes #1927
---
 .../main/java/org/apache/bookkeeper/util/LocalBookKeeper.java    | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/util/LocalBookKeeper.java
 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/util/LocalBookKeeper.java
index 97884a6..d6efeac 100644
--- 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/util/LocalBookKeeper.java
+++ 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/util/LocalBookKeeper.java
@@ -134,17 +134,16 @@ public class LocalBookKeeper {
                     .connectString(zkHost + ":" + zkPort)
                     .sessionTimeoutMs(zkSessionTimeOut)
                     .build()) {
-            List<Op> multiOps = Lists.newArrayListWithExpectedSize(3);
             String zkLedgersRootPath = 
ZKMetadataDriverBase.resolveZkLedgersRootPath(baseConf);
-            multiOps.add(
-                Op.create(zkLedgersRootPath, new byte[0], Ids.OPEN_ACL_UNSAFE, 
CreateMode.PERSISTENT));
+            ZkUtils.createFullPathOptimistic(zkc, zkLedgersRootPath, new 
byte[0], Ids.OPEN_ACL_UNSAFE,
+                    CreateMode.PERSISTENT);
+            List<Op> multiOps = Lists.newArrayListWithExpectedSize(2);
             multiOps.add(
                 Op.create(zkLedgersRootPath + "/" + AVAILABLE_NODE,
                     new byte[0], Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT));
             multiOps.add(
                 Op.create(zkLedgersRootPath + "/" + AVAILABLE_NODE + "/" + 
READONLY,
                     new byte[0], Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT));
-
             zkc.multi(multiOps);
             // No need to create an entry for each requested bookie anymore as 
the
             // BookieServers will register themselves with ZooKeeper on 
startup.
@@ -345,7 +344,6 @@ public class LocalBookKeeper {
                                           String zkDataDir,
                                           String localBookiesConfigDirName)
             throws Exception {
-
         conf.setMetadataServiceUri(
                 newMetadataServiceUri(
                         zkHost,
@@ -353,7 +351,6 @@ public class LocalBookKeeper {
                         conf.getLedgerManagerLayoutStringFromFactoryClass(),
                         conf.getZkLedgersRootPath()));
         LocalBookKeeper lb = new LocalBookKeeper(numBookies, 
initialBookiePort, conf, localBookiesConfigDirName);
-
         ZooKeeperServerShim zks = null;
         File zkTmpDir = null;
         List<File> bkTmpDirs = null;

Reply via email to