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 2020/02/14 02:47:17 UTC

[GitHub] [zookeeper] maoling commented on issue #1187: ZOOKEEPER-3414 sync api throws NoNodeException when path is non-existent

maoling commented on issue #1187: ZOOKEEPER-3414 sync api throws NoNodeException when path is non-existent
URL: https://github.com/apache/zookeeper/pull/1187#issuecomment-586071706
 
 
   > I had the assumption of this should be implemented on server side. There's no guarantee of somebody not deleting the node after getData call.
   
     - Yes, it is. Implementing on client side really has that side effect, especially a `delete` after `sync` by another client, just before `getData`. 
     - Overall, `sync + getData` isn't a good api design and some issues in it(e.g sync isn't a quorum operation and cannot get updated data when network partitioned, so I create [ZOOKEEPER-3600](https://issues.apache.org/jira/browse/ZOOKEEPER-3600) to depreciate it by a new Linearizability Read api.)
   
   - A base summary of current `sync` implementation, when the client calls the `sync` api to a follower server, follower pends the `requestA`(in the `pendingSyncs`) and forwards `requestA` to leader. when leader has no outstanding proposals(`outstandingProposals`), leader will send a `SYNC` message to follower, follower will commit `requestA` util it receives the `SYNC` from leader.
   
   - For the server side fix:
   ```
   FinalRequestProcessor
               case OpCode.sync: {
                   xxxxxxxxxxxxxxxxxxxxxxxxxx
                   path = syncRequest.getPath();
                   DataNode n = zks.getZKDatabase().getNode(path);
                   if (n == null) {
                       throw new KeeperException.NoNodeException();
                   }
                   rsp = new SyncResponse(path);
                   xxxxxxxxxxxxxxxxxxxxxxxxxx
               }
   SyncCommand:
               } else if (resultCode == KeeperException.Code.NONODE.intValue()) {
                   throw new KeeperException.NoNodeException(path);
               } else
   ```

----------------------------------------------------------------
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