Return-Path: X-Original-To: apmail-zookeeper-user-archive@www.apache.org Delivered-To: apmail-zookeeper-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6375D176B7 for ; Thu, 23 Oct 2014 20:55:21 +0000 (UTC) Received: (qmail 38166 invoked by uid 500); 23 Oct 2014 20:55:20 -0000 Delivered-To: apmail-zookeeper-user-archive@zookeeper.apache.org Received: (qmail 38119 invoked by uid 500); 23 Oct 2014 20:55:20 -0000 Mailing-List: contact user-help@zookeeper.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@zookeeper.apache.org Delivered-To: mailing list user@zookeeper.apache.org Received: (qmail 38104 invoked by uid 99); 23 Oct 2014 20:55:20 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Oct 2014 20:55:20 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of rjaltare@pivotal.io designates 209.85.214.175 as permitted sender) Received: from [209.85.214.175] (HELO mail-ob0-f175.google.com) (209.85.214.175) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Oct 2014 20:55:15 +0000 Received: by mail-ob0-f175.google.com with SMTP id wn1so1371472obc.20 for ; Thu, 23 Oct 2014 13:54:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=xy5RGc758k3ULmeZLWIxVbczOjW8wuY4IhS7Pjtwg2A=; b=Nou//piye+8lqj+NSN4mAFHr9L6kW3BbyJxGlqRBBR6150ZWsoAGo45oDRXUvWb9Ao 5/e2Hlik6AtF6leNVOwDD4IVf8MHrcbZv1770OBX0UbFyb48qUFQO3sX4YsstTj0q2zz 5MtpWAVHQMmj1I72VSwL6sSQfv0rXRh/PeEXcFnvjy1RQHZD/4PKy5TzAf4sCM8FVy/R BHCW4LmWMSe1Kkz46pzDKauvWaOEFHmd+FihkIXQkgXywUgmTw3Q9KJXUAbBv5Gwnlco 4nXOX5KIOPRpU5ncBn9Tk3+um4gV/+JoWQAlFNys+CBSJMFfrLMu0ZqBGHwv10stm94R cXdQ== X-Gm-Message-State: ALoCoQnY6jwPQJEyk059aVO+fmGNnNISkaHpos+WjrMxYSMjQzDhYINemik+bbTL5BR2TJ85I7Tj MIME-Version: 1.0 X-Received: by 10.202.68.130 with SMTP id r124mr48057oia.3.1414097648648; Thu, 23 Oct 2014 13:54:08 -0700 (PDT) Received: by 10.60.219.10 with HTTP; Thu, 23 Oct 2014 13:54:08 -0700 (PDT) In-Reply-To: References: <201410231115497082978@163.com> <201410231313135685365@163.com> Date: Thu, 23 Oct 2014 13:54:08 -0700 Message-ID: Subject: Re: RE: A question about sequential order consistency that zookeeper garantees From: Ritesh Jaltare To: user@zookeeper.apache.org Cc: "bit1129@163.com" Content-Type: multipart/alternative; boundary=001a113d65e806a4e905061d440d X-Virus-Checked: Checked by ClamAV on apache.org --001a113d65e806a4e905061d440d Content-Type: text/plain; charset=UTF-8 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. Thanks Ritesh Jaltare, Pivotal > On Wed, Oct 22, 2014 at 10:35 PM, Rakesh R 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 > > From: Rakesh R > Date: 2014-10-23 12:33 > To: user@zookeeper.apache.org; > 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] > 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 > -- Ritesh Jaltare, Pivotal --001a113d65e806a4e905061d440d--