Zookeeper Sessions


#1

[From an internal discussion]
Would you care to explain the last sentence for me please – the highlighted portion?

The session remains valid even on switching to another server.

Though the failover is handled automatically by the client library, the application can not remain agnostic of server reconnections because the operation might fail during switching to another server.


#2

The application connects to a zookeeper server to read the data. If say a particular zookeeper server is down, the connection will be routed to another machine.

Even though the switching of connection happens naturally, there are times when the application would not be able to establish connection such as during election or a particular machine going down suddenly. If the application is not built with fault tolerance in mind (such as retry at least 3 times), there are chances of dropping connection even though it is very less probable.

Now, I think this would make more sense:

Though the failover is handled automatically by the client library, the application can not remain agnostic of server reconnections because the operation might fail during switching to another server.