You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@zookeeper.apache.org by GitBox <gi...@apache.org> on 2019/12/27 07:04:52 UTC

[GitHub] [zookeeper] maoling commented on a change in pull request #1187: ZOOKEEPER-3414 sync api throws NoNodeException when path is non-existent

maoling commented on a change in pull request #1187: ZOOKEEPER-3414 sync api throws NoNodeException when path is non-existent
URL: https://github.com/apache/zookeeper/pull/1187#discussion_r361597100
 
 

 ##########
 File path: zookeeper-server/src/main/java/org/apache/zookeeper/cli/SyncCommand.java
 ##########
 @@ -74,7 +75,7 @@ public void processResult(int rc, String path, Object ctx) {
             if (resultCode == 0) {
                 out.println("Sync is OK");
             } else {
-                out.println("Sync has failed. rc=" + resultCode);
+                throw new CliWrapperException(new KeeperException.NoNodeException(path));
             }
 
 Review comment:
   - You may never get a `rc` code which tell you whether the path is exist because the server doesn't send it to the client
   - One alternative way is `getData` or `exist`  to check the existence of path after `sync`
   - `sync` api has problems and not user-friendly, we will depreciate it in the further with a new linearity read api

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services