Mahadev Konar wrote:
Hi Vinod,
 I think what Ben meant was this--

The client will never know of a session expiration until and unless its
connected to one of the servers. So the leader cannot demote itself since
its connected to one of the servers. It might have lost its session (which
all the others except itself would have realized) but will have to wait to
demote itself until it connects to one of the servers.

I guess then I don't follow the leader election recipe. Is the following scenario possible in the leader election recipe:
1) Leader L is partitioned from the ensemble.
2) ZK servers expire its session.
3) Some other follower F now becomes a leader.
4) L and F form a split brain?

I had wrongly assumed that the session was like a lease in that it allowed the client and server to independently know that the session had expired by the use of the global clock. Wouldn't it make sense for the client lib to expire its local session handle and never reuse it?
mahadev


On 1/7/09 10:02 AM, "Vinod Johnson" <thomas.john...@sun.com> wrote:

Benjamin Reed wrote:
You don't demote yourself on disconnect. (Everyone else may still believe you
are the leader.) Check out the "Things to Remember about Watches" section in
the programmer's guide.

When you are disconnected from ZK you don't know what is happening, so you
have to act conservatively. Your session may or may not have expired. You
will not know for sure until you reconnect to ZK.
Just to make sure I'm not misunderstanding the last bit, even without
reconnecting to ZK, the leader's session could expire at the client
side, correct? In that case the conservative thing for the leader to do
is to demote itself if the intent is to avoid split brain (even though
the session may still be active at ZK for some period of time after this).


Reply via email to