zookeeper-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Capwell <dcapw...@gmail.com>
Subject mixing persitent and persitent sequential throws NodeExists for sequential mode
Date Wed, 01 Jul 2015 17:54:26 GMT
I have the following code (in curator):

int id = extractId(client.create().creatingParentsIfNeeded().withMode(CreateMode.PERSISTENT_SEQUENTIAL).forPath(prefix,



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 several test cases and saw that this was working, but
created another test and got a unexpected exception (I put the
exception at the bottom)

Here is the test:

create 4 PERSISTENT znodes with ids 1, 2, 3, 4
create 1 PERSISTENT_SEQUENTIAL znode (expecting id = 0)

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
Error:KeeperErrorCode = NodeExists for

KeeperErrorCode = NodeExists for
Caused by: org.apache.zookeeper.KeeperException$NodeExistsException:
KeeperErrorCode = NodeExists for
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)

Why is the sequential mode failing (and why does the log say its
trying with 4, but error doesn't include id)?

Curator: 2.6.1
Zookeeper: 3.4.5

Thanks for your time reading this email.

View raw message