You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@zookeeper.apache.org by Nathan Yu <Nu...@twosigma.com> on 2016/02/22 20:27:02 UTC

Clarification on ZooKeeper.getState().isAlive() and ephemeral nodes

Say I have two clients, Alice and Bob

1. Alice creates ephemeral node /foo
2. Bob sees ephemeral node /foo
3. Alice's session expires.
4. Bob sees ephemeral /foo disappear.
5. Alice checks ZooKeeper.getState().isAlive()

Is there a guarantee that Alice's ZooKeeper.getState().isAlive() will always return false  at step 5?

RE: Clarification on ZooKeeper.getState().isAlive() and ephemeral nodes

Posted by Nathan Yu <Nu...@twosigma.com>.
Yeah, I mean the leader has expired Alice's session. Is there some time interval (some function of session timeout) that would ensure Alice gets 'false'? 


-Nathan

-----Original Message-----
From: Flavio Junqueira [mailto:fpjunqueira@yahoo.com.INVALID] 
Sent: Monday, February 22, 2016 5:47 PM
To: user@zookeeper.apache.org
Subject: Re: Clarification on ZooKeeper.getState().isAlive() and ephemeral nodes

The ensemble leader is responsible for expiring sessions. If in step 3 you mean that the leader has expired Alice's session, then it might be the case that Alice doesn't know yet by step 5. However, if step 3 means that Alice has already been notified of the state change, then it will be false.

-Flavio


> On 22 Feb 2016, at 19:27, Nathan Yu <Nu...@twosigma.com> wrote:
> 
> Say I have two clients, Alice and Bob
> 
> 1. Alice creates ephemeral node /foo
> 2. Bob sees ephemeral node /foo
> 3. Alice's session expires.
> 4. Bob sees ephemeral /foo disappear.
> 5. Alice checks ZooKeeper.getState().isAlive()
> 
> Is there a guarantee that Alice's ZooKeeper.getState().isAlive() will always return false  at step 5?


Re: Clarification on ZooKeeper.getState().isAlive() and ephemeral nodes

Posted by Flavio Junqueira <fp...@yahoo.com.INVALID>.
The ensemble leader is responsible for expiring sessions. If in step 3 you mean that the leader has expired Alice's session, then it might be the case that Alice doesn't know yet by step 5. However, if step 3 means that Alice has already been notified of the state change, then it will be false.

-Flavio


> On 22 Feb 2016, at 19:27, Nathan Yu <Nu...@twosigma.com> wrote:
> 
> Say I have two clients, Alice and Bob
> 
> 1. Alice creates ephemeral node /foo
> 2. Bob sees ephemeral node /foo
> 3. Alice's session expires.
> 4. Bob sees ephemeral /foo disappear.
> 5. Alice checks ZooKeeper.getState().isAlive()
> 
> Is there a guarantee that Alice's ZooKeeper.getState().isAlive() will always return false  at step 5?