You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by "maoling (JIRA)" <ji...@apache.org> on 2019/02/23 08:54:00 UTC

[jira] [Commented] (ZOOKEEPER-2226) Mixing sequential and non-sequential can throw NodeExists for sequential nodes

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

maoling commented on ZOOKEEPER-2226:
------------------------------------

[~dcapwell]

NodeExists Exception which had been thrown rests only with the path, not the node type(PERSISTENT or PERSISTENT_SEQUENTIAL).

> Mixing sequential and non-sequential can throw NodeExists for sequential nodes
> ------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-2226
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2226
>             Project: ZooKeeper
>          Issue Type: Bug
>    Affects Versions: 3.4.5
>            Reporter: David Capwell
>            Priority: Major
>
> I have the following code (in curator):
> {code}
> int id = extractId(client.create().creatingParentsIfNeeded().withMode(CreateMode.PERSISTENT_SEQUENTIAL).forPath(prefix,
> data));
> {code}
> and
> {code}
> client.create().creatingParentsIfNeeded().withMode(CreateMode.PERSISTENT).forPath(path(id),
> data);
> {code}
> The first part joins our cluster and gets a id from zookeeper.  The
> second call will create a znode that looks like a znode above.
> The reason I do this is that I would like for ops to be able to define
> the ids when they want and not always have to (other code will
> "setData" one of the paths defined above, leaving out since thats not
> having issues).
> I created a test case and the error thrown was not what I was expecing: Node Exists
> Here is the test:
> create 4 PERSISTENT znodes with ids 1, 2, 3, 4
> create 1 PERSISTENT_SEQUENTIAL znode (change id = 4, so conflicts with above)
> Here is the error I saw
> INFO 2015-07-01 10:46:46,349 [ProcessThread(sid:0 cport:-1):]
> [PrepRequestProcessor] [line 627] Got user-level KeeperException when
> processing sessionid:0x14e4aba4d490000 type:create cxid:0x25 zxid:0xe
> txntype:-1 reqpath:n/a Error
> Path:/test/MembershipTest/replaceFourRegisterOne/member-0000000004
> Error:KeeperErrorCode = NodeExists for
> /test/MembershipTest/replaceFourRegisterOne/member-0000000004
> org.apache.zookeeper.KeeperException$NodeExistsException:
> KeeperErrorCode = NodeExists for
> /test/MembershipTest/replaceFourRegisterOne/member-
> ...
> Caused by: org.apache.zookeeper.KeeperException$NodeExistsException:
> KeeperErrorCode = NodeExists for
> /test/MembershipTest/replaceFourRegisterOne/member-
> at org.apache.zookeeper.KeeperException.create(KeeperException.java:119)
> at org.apache.zookeeper.KeeperException.create(KeeperException.java:51)
> at org.apache.zookeeper.ZooKeeper.create(ZooKeeper.java:783)
> at org.apache.curator.framework.imps.CreateBuilderImpl$11.call(CreateBuilderImpl.java:688)
> at org.apache.curator.framework.imps.CreateBuilderImpl$11.call(CreateBuilderImpl.java:672)
> at org.apache.curator.RetryLoop.callWithRetry(RetryLoop.java:107)
> at org.apache.curator.framework.imps.CreateBuilderImpl.pathInForeground(CreateBuilderImpl.java:668)
> at org.apache.curator.framework.imps.CreateBuilderImpl.protectedPathInForeground(CreateBuilderImpl.java:453)
> at org.apache.curator.framework.imps.CreateBuilderImpl.forPath(CreateBuilderImpl.java:443)
> at org.apache.curator.framework.imps.CreateBuilderImpl.forPath(CreateBuilderImpl.java:44)
> When using sequential nodes, its unexpected that they can fail because a node already exists.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)