Is sync effectively recursive?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Is sync effectively recursive?

Ivan Chernetsky
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.
Reply | Threaded
Open this post in threaded view
|

Re: Is sync effectively recursive?

Ivan Kelly-2
> 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
Reply | Threaded
Open this post in threaded view
|

Re: Is sync effectively recursive?

Ivan Chernetsky
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.