[
https://issues.apache.org/jira/browse/ZOOKEEPER-1388?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13850153#comment-13850153
]
Rakesh R commented on ZOOKEEPER-1388:
-------------------------------------
Thanks [~marshall] for the interest.
AFAIK, the idea of path validation is to "fail fast in the client side itself
with user friendly error messages". I think, this will not violate the zab
protocol. Also, the path validation utility is used in all the other
zookeeper.java client apis.
Since the znode string path (user passed parameter) is not following the basic
znode path principles, the operation will definitely fail in server side and
will not goes to zab protocol logic. If we have this utility in place, this
will do the validation in client side itself and give the proper error message.
Zookeeper java client has special path validation utility, which will do very
basic validation of znode path string, like :
- Path cannot be null
- Path length must be > 0
- Path must start with / character
- Path must not end with / character
- and many more..please see 'org.apache.zookeeper.common.PathUtils.java' for
the understanding.
> 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)