[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-1388?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13850111#comment-13850111
 ] 

Marshall McMullen commented on ZOOKEEPER-1388:
----------------------------------------------

I'm not too familiar with how the client-side path validation works in the java 
client code. We don't do anything similar to that in the C client code (that 
I'm aware of). Can someone explain how that is safe? If the client is connected 
to a server that does not have a fully sync'd copy of the database then the 
client may preemptively fail the multi-op whereas if it had forwarded the 
entire multi-op to the server it would have properly succeeded. 

It's really important to understand that the original design we followed with a 
multi-op was to treat it as a transaction (write operation) rather than a read 
operation. As a transaction/write operation, it's my understanding of zab that 
we are required to forward the operation on to the leader rather than taking 
any action locally so that the leader can broadcast out the transaction to the 
entire ensemble for consideration. 

If the client does any path validation locally that seems like a violation of 
the zab protocol as I understand it.

Someone feel free to correct me if I am misunderstanding things.

> Client side 'PathValidation' is missing for the multi-transaction api.
> ----------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-1388
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1388
>             Project: ZooKeeper
>          Issue Type: Bug
>          Components: java client
>    Affects Versions: 3.4.0
>            Reporter: Rakesh R
>            Assignee: Rakesh R
>             Fix For: 3.4.6, 3.5.0
>
>         Attachments: 0001-ZOOKEEPER-1388-trunk-version.patch, 
> 0002-ZOOKEEPER-1388-trunk-version.patch, ZOOKEEPER-1388.patch, 
> ZOOKEEPER-1388.patch, ZOOKEEPER-1388.patch, ZOOKEEPER-1388_branch_3_4.patch
>
>
> Multi ops: Op.create(path,..), Op.delete(path, ..), Op.setData(path, ..), 
> Op.check(path, ...) apis are not performing the client side path validation 
> and the call will go to the server side and is throwing exception back to the 
> client. 
> It would be good to provide ZooKeeper client side path validation for the 
> multi transaction apis. Presently its getting err codes from the server, 
> which is also not properly conveying the cause.
> For example: When specified invalid znode path in Op.create, it giving the 
> following exception. This will not be useful to know the actual cause.
> {code}
> org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode
>       at org.apache.zookeeper.KeeperException.create(KeeperException.java:115)
>       at org.apache.zookeeper.ZooKeeper.multiInternal(ZooKeeper.java:1174)
>       at org.apache.zookeeper.ZooKeeper.multi(ZooKeeper.java:1115)
> {code}



--
This message was sent by Atlassian JIRA
(v6.1.4#6159)

Reply via email to