You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@zookeeper.apache.org by Ivan Chernetsky <ic...@mesosphere.com> on 2017/09/22 18:30:33 UTC

Is sync effectively recursive?

Hello everybody,

Let's assume there are two clients: A and B

The client A writes to a bunch of nodes, let's say, to

  - /parent
  - /parent/childA
  - /parent/childB

Then the client A shuts down, and the client B comes up. If the client B
does a sync on /, is it safe to assume that reading /parent, or
/parent/childA or any other node is safe meaning that the client B will see
all the most recent updates made by the client A?

Thank you!

Regards,
Ivan.

Re: Is sync effectively recursive?

Posted by Ivan Chernetsky <ic...@mesosphere.com>.
Hi Ivan,

Thanks a lot for getting back to me so quickly.

> > Then the client A shuts down, and the client B comes up. If the client B
> > does a sync on /, is it safe to assume that reading /parent, or
> > /parent/childA or any other node is safe meaning that the client B will see
> > all the most recent updates made by the client A?

> Yes, sync flushes the channels between the connected server and the
> leader, so once you call sync, any further requests will see at least
> the true state of the cluster at the time the sync was called. I dunno
> why it takes a path, since zk has only one log.

This is what I assumed, and it absolutely makes sense. Though I was
not sure whether all the in-memory data structures get updated for _all_
ZK nodes on a log sync. Just wanted to double-check.

Thanks again.

Regards,
Ivan.

Re: Is sync effectively recursive?

Posted by Ivan Kelly <iv...@apache.org>.
> Then the client A shuts down, and the client B comes up. If the client B
> does a sync on /, is it safe to assume that reading /parent, or
> /parent/childA or any other node is safe meaning that the client B will see
> all the most recent updates made by the client A?
Yes, sync flushes the channels between the connected server and the
leader, so once you call sync, any further requests will see at least
the true state of the cluster at the time the sync was called. I dunno
why it takes a path, since zk has only one log.

-Ivan