zookeeper-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ritesh Jaltare <rjalt...@pivotal.io>
Subject Re: RE: A question about sequential order consistency that zookeeper garantees
Date Thu, 23 Oct 2014 20:54:08 GMT
Hi bit1129

Zookeeper provides 2 basic ordering guarantees:

1) Linearizable writes: What this means is all updates that change the
state of zookeeper are serializable and respect the precedence order.

2) FIFO client order: All requests from a given client are executed in the
order that they were sent by the client.

Now let us take your scenario and see how these 2 ordering guarantees
interact. . Suppose Client 1 sends request-1A and  request-1B in order  and
Client2 sends request-2A and request-2B in order. These requests can reach
the zookeeper server in any order. What zookeeper guarantees is that
 request-1A and request-1B would retain the same order in the processing
pipeline. That is,  request-1B would be processed by zookeeper only after
request-1A. And similarly for Client 2 , request-2B would be processed by
zookeeper only after request-2A.

So the possible valid orderings are

Request-2A -> Request-1A -> Request 2B -> Request-1B

Request-1A -> Request-2A -> Request 2B -> Request-1B

Request-1A -> Request-2A -> Request 1B -> Request-2B

and so on...

In each of thee orderings, you can see that zookeeper maintains a fifo
client order. What zookeeper offers is Asynchronous Linearizability and not
sequential consistency. Asynchronous Linearizability is a stonger condition
that sequential consistency.

Ritesh Jaltare, Pivotal


On Wed, Oct 22, 2014 at 10:35 PM, Rakesh R <rakeshr@huawei.com> wrote:

> Yes.
> -Rakesh
> From: bit1129@163.com [mailto:bit1129@163.com]
> Sent: 23 October 2014 10:43
> To: Rakesh R
> Subject: Re: RE: A question about sequential order consistency that
> zookeeper garantees
> Thanks Rakesh for the quick reply. So, I understand that the time that
> clients send the request doesn't matter,but the server will "queue" the
> request and process the request.
> ________________________________
> bit1129@163.com<mailto:bit1129@163.com>
> From: Rakesh R<mailto:rakeshr@huawei.com>
> Date: 2014-10-23 12:33
> To: user@zookeeper.apache.org<mailto:user@zookeeper.apache.org>;
> bit1129@163.com<mailto:bit1129@163.com>
> Subject: RE: A question about sequential order consistency that zookeeper
> garantees
> Hi,
> Sequential Order Guarantee:
> ---------------------------
> Server view:- It will process the requests in sequential fashion.
> Say, there are two clients connected with the server, client-1 and
> client-2.
> Assume application had created a znode /myapp and there is a logic to do
> distributed locking mechanism. Now both these clients will try to acquire
> lock by creating '/myapp/lock' znode. I'm calling these requests as
> request-1(create /myapp/lock) and request-2(create /myapp/lock). Again
> assume, server receives the requests in the order of request-2 and then
> request-1. For simplicity, you can imagine there is a Queue maintained at
> the server and all these requests will be put into this Queue and executes
> in FIFO order. First, server will pick request-2 and creates /myapp/lock
> znode. Also, it will send watcher notifications if anyone has registered.
> Then move on to the next request-2(create /myapp/lock), while executing
> this will throw exception saying NodeExistsException.
> ZooKeeper maintains global ordering but how? - Every write is assigned a
> globally unique id, sequentially ordered identifier called a zxid, or
> ZooKeeper transaction id. This guarantees a global order to all updates in
> a ZooKeeper ensemble.
> Regards,
> Rakesh
> -----Original Message-----
> From: bit1129@163.com<mailto:bit1129@163.com> [mailto:bit1129@163.com]
> Sent: 23 October 2014 08:46
> To: user
> Subject: A question about sequential order consistency that zookeeper
> garantees
> Hi,Zookeepers,
> I'd like to ask a question about sequential order consistency that
> zookeeper garantees.
> Say, 2 zookeeper clients want to update the same znode data one after the
> other.Client1 sends the request 1 second before Client2.
> What would be the end result? There is no order gurantee here, dure to
> network delay, it is likely that clients1 send the request before client2,
> but the zookeeper servers first execute the request from Client1 before
> client2
> If this is not what sequential order consistency means, then what exactly
> does sequential order consistencymeans, what does zookeeper exactly
> garantee?
> Thanks.
> bit1129@163.com<mailto:bit1129@163.com>

Ritesh Jaltare, Pivotal

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message