1

In my understanding, Zookeeper doesn't guarantee to return the newest value, because a client may be connecting to a server that doesn't receive the newest update request.

Let's suppose that if I use one client and three servers, for example, client M, server {A, B, C}, and A becomes a leader, B, C become followers. I think this is what may happen below:

  1. znode z has value "zero".
  2. M connects to server C (follower)
  3. M set znode z to "one".
  4. C send request (setData z "one") to A, which is a leader.
  5. M is waiting for success, then A and B successfully set node z to "one".
  6. M getData z, then C returns value "zero" to M. (just read local)
  7. C successfully set node z to "one".
  8. M getData z again, then get "one" from C.

Then M data will have a "backward", M write "one" then read "zero".

My questions is:

  1. Is my description about what zookeeper actually works correct? I mean the same client can write "one" but read "zero".
  2. If one client can write "one" and must read "one" after writing, how can Zookeeper do that?
SJZ
  • 93
  • 6
  • Does this answer your question? [Apache ZooKeeper: How do writes work](https://stackoverflow.com/questions/5420087/apache-zookeeper-how-do-writes-work) – Abhijit Sarkar Oct 12 '22 at 02:07
  • Client has to call the `sync()` method from the ZooKeeper API method in order to get thr latest value – Areej Fatimah Oct 21 '22 at 11:38

0 Answers0