You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@zookeeper.apache.org by "Jingguo Yao (Jira)" <ji...@apache.org> on 2020/03/29 02:28:00 UTC

[jira] [Updated] (ZOOKEEPER-3773) Version argument should be checked at the client side

     [ https://issues.apache.org/jira/browse/ZOOKEEPER-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jingguo Yao updated ZOOKEEPER-3773:
-----------------------------------
    Description: 
Both setData and delete APIs have an argument version. The Javadoc for both APIs says:
{quote}The call will succeed if such a node exists, and the given version matches the
 node's version (if the given version is -1, it matches any node's versions
{quote}
The Javadoc does not specify the behavior if version is less that -1. Here is the behavior I have observed:
 # If the znode does not exist, KeeperException.NoNodeException is thrown.
 # Otherwise, KeeperException.BadVersionException is thrown.

And the above behavior also holds for Op.Check, Op.Delete and Op.SetData with a version less than -1.

A check of the source code shows that both exception are resulted by checks on the server side. I suggest to do a check on the client. If version is less than -1, KeeperException.BadVersionException is thrown..

  was:
Both setData and delete APIs have an argument version. The Javadoc for both APIs says:
{quote}The call will succeed if such a node exists, and the given version matches the
 node's version (if the given version is -1, it matches any node's versions
{quote}
The Javadoc does not specify the behavior if version is less that -1. Here is the behavior I have observed:
 # If the znode does not, KeeperException.NoNodeException is thrown.
 # Otherwise, KeeperException.BadVersionException is thrown.

And the above behavior also holds for Op.Check, Op.Delete and Op.SetData with a version less than -1.

A check of the source code shows that both exception are resulted by checks on the server side. I suggest to do a check on the client. If version is less than -1, KeeperException.BadVersionException is thrown..


> Version argument should be checked at the client side
> -----------------------------------------------------
>
>                 Key: ZOOKEEPER-3773
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-3773
>             Project: ZooKeeper
>          Issue Type: Improvement
>          Components: java client
>    Affects Versions: 3.5.5
>            Reporter: Jingguo Yao
>            Priority: Minor
>
> Both setData and delete APIs have an argument version. The Javadoc for both APIs says:
> {quote}The call will succeed if such a node exists, and the given version matches the
>  node's version (if the given version is -1, it matches any node's versions
> {quote}
> The Javadoc does not specify the behavior if version is less that -1. Here is the behavior I have observed:
>  # If the znode does not exist, KeeperException.NoNodeException is thrown.
>  # Otherwise, KeeperException.BadVersionException is thrown.
> And the above behavior also holds for Op.Check, Op.Delete and Op.SetData with a version less than -1.
> A check of the source code shows that both exception are resulted by checks on the server side. I suggest to do a check on the client. If version is less than -1, KeeperException.BadVersionException is thrown..



--
This message was sent by Atlassian Jira
(v8.3.4#803005)