Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Zookeeper >> mail # user >> Consistency in zookeeper

Copy link to this message
RE: Consistency in zookeeper
sync() guarantees that it will synchronize the data between the zk servers at 't' th time.

Say we have two clients and both are working on the same key path:

First client C1, is updating the value of x at 't1', 't2' and 't3' as follows.
at t1 time, value of x = 4
at t2 time, update value of x = 5
at t3 time, update value of x = 6

Second client C2, which is doing sync() at 't2' time and invoke a read() req at 't3' time.
(Ignoring the race condition between the updation of C1 and sync of C2, here assume C1 update has happened first). Now C2 will see value of x=5 from any of the ZK servers(Leader/Followers), but C2 is not guranteed to see value of x=6, as updation happened after sync() api call.


From: Ted Dunning [[EMAIL PROTECTED]]
Sent: Saturday, March 02, 2013 7:33 AM
Subject: Re: Consistency in zookeeper

Yes.  Sync doesn't guarantee up to date.  It guarantees an ordering.  It
guarantees that if event A involves a ZK update and if you can guarantee
that A occurs before sync, then any read on a client C that is done after a
sync on C will see a successor state of A.

On Fri, Mar 1, 2013 at 2:01 PM, Jordan Zimmerman <[EMAIL PROTECTED]
> wrote:

> Even if you do the sync, another client can make a change before you do
> the subsequent read.
> -JZ
> On Mar 1, 2013, at 1:50 PM, Martin Kou <[EMAIL PROTECTED]> wrote:
> > Yasin,
> >
> > If the two clients are connected to two different ZooKeeper servers in
> the
> > cluster, then, yes.
> >
> > Generally, if you're worried that there may be another client working on
> > the same key path, then you should sync() before reading.
> >
> > Best Regards,
> > Martin Kou
> >
> > On Fri, Mar 1, 2013 at 1:38 PM, Yasin <[EMAIL PROTECTED]> wrote:
> >
> >> So, if the read request is made by some other client, it will not get
> the
> >> updated value without sync, right?
> >>
> >>
> >>
> >> --
> >> View this message in context:
> >>
> http://zookeeper-user.578899.n2.nabble.com/Consistency-in-zookeeper-tp7578531p7578542.html
> >> Sent from the zookeeper-user mailing list archive at Nabble.com.
> >>