You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@zookeeper.apache.org by "Vazhenin, Maksim" <Ma...@dell.com> on 2016/12/02 11:59:31 UTC

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

Re: ephemeral nodes. atomic invalidation on session expiration?

Posted by Lakshmikanth Sivakumar <ia...@live.com>.
Hi There,

Please unsubscribe from these e-mail notifications.

Sent from Windows Mail

From: Vazhenin, Maksim<ma...@dell.com>
Sent: ?Thursday?, ?08? ?December? ?2016 ?19?:?36
To: user@zookeeper.apache.org<ma...@zookeeper.apache.org>

Does anyone have insight into this one?

Thanks,
Maksim

-----Original Message-----
From: Vazhenin, Maksim [mailto:Maksim.Vazhenin@dell.com]
Sent: Friday, December 02, 2016 3:00 PM
To: user@zookeeper.apache.org
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

RE: ephemeral nodes. atomic invalidation on session expiration?

Posted by "Vazhenin, Maksim" <Ma...@dell.com>.
Thanks,

Confirmed from zookeeper source code and from testing that ephemeral nodes for session are removed not atomically.

2016-12-15 13:55:15,865 [CommitProcessor:3] DEBUG  DataTree.java (line 901) Deleting ephemeral node /test1 for session 0x15902bdf4970000
2016-12-15 13:55:15,866 [CommitProcessor:3] DEBUG  DataTree.java (line 901) Deleting ephemeral node /test2 for session 0x15902bdf4970000

-Maksim

-----Original Message-----
From: Mike Solomon [mailto:msolo@dropbox.com] 
Sent: Friday, December 09, 2016 1:20 AM
To: user@zookeeper.apache.org
Subject: Re: ephemeral nodes. atomic invalidation on session expiration?

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 <Ma...@dell.com> wrote:
> Does anyone have insight into this one?
>
> Thanks,
> Maksim
>
> -----Original Message-----
> From: Vazhenin, Maksim [mailto:Maksim.Vazhenin@dell.com]
> Sent: Friday, December 02, 2016 3:00 PM
> To: user@zookeeper.apache.org
> 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

Re: ephemeral nodes. atomic invalidation on session expiration?

Posted by Mike Solomon <ms...@dropbox.com>.
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
<Ma...@dell.com> wrote:
> Does anyone have insight into this one?
>
> Thanks,
> Maksim
>
> -----Original Message-----
> From: Vazhenin, Maksim [mailto:Maksim.Vazhenin@dell.com]
> Sent: Friday, December 02, 2016 3:00 PM
> To: user@zookeeper.apache.org
> 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

RE: ephemeral nodes. atomic invalidation on session expiration?

Posted by "Vazhenin, Maksim" <Ma...@dell.com>.
Does anyone have insight into this one?

Thanks,
Maksim

-----Original Message-----
From: Vazhenin, Maksim [mailto:Maksim.Vazhenin@dell.com] 
Sent: Friday, December 02, 2016 3:00 PM
To: user@zookeeper.apache.org
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