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).