aloyszhang opened a new issue #2900:
URL: https://github.com/apache/bookkeeper/issues/2900


   **BUG REPORT**
   
   Bookie can't startup with a comma-separated `metadataServiceUri`
   ***Describe the bug***
   Bookie can't parse a comma-separated configuration.
   
   ***To Reproduce***
   
   Steps to reproduce the behavior:
   1. Set the `metadataServiceUri` with a comma-separated  value like
   ```shell
   
metadataServiceUri=zk+hierarchical://localhost:2181,localhost:2182,localhost:2183/ledgers
   ```
   2. then start bookie will get the exception:
   ```shell
   2021-11-17 17:21:25,383 - ERROR [main:Main@228] - Failed to build bookie 
server
   java.lang.IllegalArgumentException: Path length must be > 0
           at 
org.apache.zookeeper.common.PathUtils.validatePath(PathUtils.java:46)
           at org.apache.zookeeper.ZooKeeper.exists(ZooKeeper.java:2235)
           at 
org.apache.bookkeeper.zookeeper.ZooKeeperClient.access$2301(ZooKeeperClient.java:70)
           at 
org.apache.bookkeeper.zookeeper.ZooKeeperClient$13.call(ZooKeeperClient.java:833)
           at 
org.apache.bookkeeper.zookeeper.ZooKeeperClient$13.call(ZooKeeperClient.java:827)
           at 
org.apache.bookkeeper.zookeeper.ZooWorker.syncCallWithRetries(ZooWorker.java:140)
           at 
org.apache.bookkeeper.zookeeper.ZooKeeperClient.exists(ZooKeeperClient.java:827)
           at 
org.apache.bookkeeper.discover.ZKRegistrationManager.getClusterInstanceId(ZKRegistrationManager.java:415)
           at 
org.apache.bookkeeper.bookie.Bookie.checkEnvironmentWithStorageExpansion(Bookie.java:432)
           at 
org.apache.bookkeeper.bookie.Bookie.checkEnvironment(Bookie.java:273)
           at org.apache.bookkeeper.bookie.Bookie.<init>(Bookie.java:731)
           at 
org.apache.bookkeeper.proto.BookieServer.newBookie(BookieServer.java:152)
           at 
org.apache.bookkeeper.proto.BookieServer.<init>(BookieServer.java:120)
           at 
org.apache.bookkeeper.server.service.BookieService.<init>(BookieService.java:52)
           at org.apache.bookkeeper.server.Main.buildBookieServer(Main.java:304)
           at org.apache.bookkeeper.server.Main.doMain(Main.java:226)
           at org.apache.bookkeeper.server.Main.main(Main.java:208)
   ```
   
   ***Expected behavior***
   
   Bookie should startup normally.
   
   ***Screenshots***
   
   
   ***Additional context***
   
   This is because when parsing the configuration file, the bookie will split 
truncate comma-separated values.
   
![image](https://user-images.githubusercontent.com/48062889/142174555-1f6cdb00-b6a3-4dcd-8f68-04157de99d88.png)
   So, will get the wrong  `LedgerRootPath`.
   
   An alternative way is adding an escape character for  comma-separated like
   ``shell
   
metadataServiceUri=zk+hierarchical://localhost:2181\,localhost:2182\,localhost:2183/ledgers
   ```
   But this way is not friendly to users.
   
   I think we should fix this problem in bookie, what do you think @eolivelli 
@Vanlightly ? If you both agree, I'll send a pull request soon.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to