Thank you, I appreciate the feedback. On Fri, Oct 2, 2015 at 10:01 AM, Raúl Gutiérrez Segalés <[email protected] > wrote:
> On 2 October 2015 at 09:48, Benjamin Jaton <[email protected]> > wrote: > > > Hi, > > > > In a small test class I keep creating/deleting the same node /test. > > > > I kill (Ctrl+C) and restart the ZK server in the command line randomly. > > > > After a couple attempts here is what we get: > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > *Fri Oct 02 09:27:23 PDT 2015 - Deleting /testFri Oct 02 09:27:23 PDT > 2015 > > - /test has been deleted.Fri Oct 02 09:27:23 PDT 2015 - Node /test has > > successfully been removed.Fri Oct 02 09:27:23 PDT 2015 - Recreating > > /testFri Oct 02 09:27:23 PDT 2015 - CONN LOST on createFri Oct 02 > 09:27:24 > > PDT 2015 - ERROR: node should be removed.Fri Oct 02 09:27:24 PDT 2015 - > > Data of node is: testNode has been mysteriously > > created...org.apache.zookeeper.KeeperException$NodeExistsException: > > KeeperErrorCode = NodeExists for /test at > > org.apache.zookeeper.KeeperException.create(KeeperException.java:123) > at > > org.apache.zookeeper.KeeperException.create(KeeperException.java:51) > at > > org.apache.zookeeper.ZooKeeper.create(ZooKeeper.java:1209) at > > TestZKSaveConnLoss.create(TestZKSaveConnLoss.java:101) at > > TestZKSaveConnLoss.access$4(TestZKSaveConnLoss.java:98) at > > TestZKSaveConnLoss$2.run(TestZKSaveConnLoss.java:56)* > > > > The 1st create fails with a ConnectionLossException. > > When we retry to create the node, we get a NodeExistsException. > > > > So the node got created despite the ConnectionLossException. > > The same thing happens with the delete operation. > > > > I was wondering if this is an known/expected behavior and how people deal > > with it? > > > > It's totally legit. Say you have: > > client> sends create /foo > server> receives receives requests and fwds to the leader > server> is about to reply that the create happened > ... RSTs are injected and socket goes away ... > client> sees ConnectionLoss > > The way the client would deal with this is by calling exists() on the nodes > it cares about, after recovering > from ConnectionLoss. > > > -rgs >
