Details
-
Sub-task
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
If ZK doesn't receive any communication from a zkClient (including heartbeats) for a session timeout period, it closes the session with the client. It removes all the ephemeral nodes associated with the client. That's why we need to restore all these nodes - need to re-register.
We are using ZkClient library to connect to zookeeper. This library allows us to get notification when the session is closed and when a new session is created. So when the new session is created we reset all session related state and re-register.
One weird feature of the library/zookeeper is that when a new session is established, it is still possible to receive old notifications. To avoid this we introduce generation number which we pass into each callback. And if the generation number has changed when the callback was invoked, we will ignore this callback.
Attachments
Issue Links
- links to