I think you cannot make any assumptions across two nodes unless you are explicitly ordering events in your application or using a transaction.
I suspect that the order of ephemeral node removals is not guaranteed, but that all ephemerals will be removed before a session is considered expired. The best way to confirm this is to write some example client code and the dump the transaction log. I suspect each node removal is a separate transaction, but the log will easily confirm that. On Thu, Dec 8, 2016 at 6:04 AM, Vazhenin, Maksim <[email protected]> wrote: > Does anyone have insight into this one? > > Thanks, > Maksim > > -----Original Message----- > From: Vazhenin, Maksim [mailto:[email protected]] > Sent: Friday, December 02, 2016 3:00 PM > To: [email protected] > Subject: ephemeral nodes. atomic invalidation on session expiration? > > Hi, > > Could you please clarify expected behavior in the following case: > 1. Client connects to zk and creates ephemeral nodes /n1 and /n2 (using > session1). > 2. Client dies. > 3. Client connects with new session to zk before session1 expired. > 4. Client checks if /n1 exists and waits till it dies. > 5. Is it guaranteed that /n2 will also be dead at this point? Or /n2 could > still be alive (waiting till zk server)? > > In other words does zk invalidates ephemeral nodes for a session atomically > or not? (If it is not atomic then during some short time client could see > part of ephemeral nodes removed and part of them still present for expired > session?) > > It is not clear from the documentation: > "ZooKeeper also has the notion of ephemeral nodes. These znodes exists as > long as the session that created the znode is active. When the session ends > the znode is deleted. Because of this behavior ephemeral znodes are not > allowed to have children." > > If this happens not atomically, what is the correct timeout client need to > wait to ensure that all ephemeral nodes from its previous session are > removed? (sessionTimeout which client sent in request when creating session? ) > > Thanks in advance, > -Maksim
