What is the best approach to have an idempotent create() operation for a
Suppose a client is trying to create a sequential node and it gets a
ConnectionLoss KeeperException, it cannot know for sure whether the request
succeeded or not. If in the meantime, the client's session is
re-established, the client would like to create a sequential znode again.
However, the client needs to know if its earlier request has succeeded or
not. If it did, then the client does not need to retry. To my understanding
ZooKeeper does not provide this feature. Can someone confirm this?
External to ZooKeeper, the client can either set a unique UUID in the path
to the create call or write the UUID as part of its data. Before retrying,
it can read back all the children of the parent znode and go through the
list to determine if its earlier request had succeeded. This doesn't sound
that appealing to me.
I am guessing this is a common problem that many would have faced. Can folks
give a feedback on what their approach was?