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 3FF7A17E7A for ; Thu, 23 Oct 2014 04:36:33 +0000 (UTC) Received: (qmail 7983 invoked by uid 500); 23 Oct 2014 04:36:32 -0000 Delivered-To: apmail-zookeeper-user-archive@zookeeper.apache.org Received: (qmail 7936 invoked by uid 500); 23 Oct 2014 04:36:32 -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 7916 invoked by uid 99); 23 Oct 2014 04:36:32 -0000 Received: from ec2-54-191-145-13.us-west-2.compute.amazonaws.com (HELO mx1-us-west.apache.org) (54.191.145.13) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Oct 2014 04:36:32 +0000 Received: from mx1-us-west.apache.org (localhost [127.0.0.1]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with ESMTP id 9689025D60 for ; Thu, 23 Oct 2014 04:36:31 +0000 (UTC) Received: by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org, from userid 114) id 89B5326E49; Thu, 23 Oct 2014 04:36:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mx1-us-west.apache.org X-Spam-Level: X-Spam-Status: No, score=-2.1 required=10.0 tests=RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,RP_MATCHES_RCVD,SPF_PASS autolearn=disabled version=3.4.0 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [119.145.14.66]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with ESMTPS id 6857D25D60 for ; Thu, 23 Oct 2014 04:36:29 +0000 (UTC) Received: from 172.24.2.119 (EHLO szxeml419-hub.china.huawei.com) ([172.24.2.119]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id AVY31388; Thu, 23 Oct 2014 12:33:11 +0800 (CST) Received: from szxeml561-mbx.china.huawei.com ([169.254.5.20]) by szxeml419-hub.china.huawei.com ([10.82.67.158]) with mapi id 14.03.0158.001; Thu, 23 Oct 2014 12:33:09 +0800 From: Rakesh R To: "user@zookeeper.apache.org" , "bit1129@163.com" Subject: RE: A question about sequential order consistency that zookeeper garantees Thread-Topic: A question about sequential order consistency that zookeeper garantees Thread-Index: AQHP7m+ql7xiVJRUvEq/49CaFRPBm5w9DApQ Date: Thu, 23 Oct 2014 04:33:09 +0000 Message-ID: References: <201410231115497082978@163.com> In-Reply-To: <201410231115497082978@163.com> Accept-Language: en-US, zh-CN Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.18.170.130] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020209.54488507.00D1,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=169.254.5.20, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 47bba9985f8baa5ce8ce6a98d166ec83 X-Virus-Scanned: ClamAV using ClamSMTP Hi, Sequential Order Guarantee: --------------------------- Server view:- It will process the requests in sequential fashion.=20 Say, there are two clients connected with the server, client-1 and client-2= .=20 Assume application had created a znode /myapp and there is a logic to do di= stributed locking mechanism. Now both these clients will try to acquire loc= k 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 si= mplicity, 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. Fir= st, 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 n= ext request-2(create /myapp/lock), while executing this will throw exceptio= n saying NodeExistsException. ZooKeeper maintains global ordering but how? - Every write is assigned a gl= obally unique id, sequentially ordered identifier called a zxid, or ZooKeep= er transaction id. This guarantees a global order to all updates in a ZooKe= eper ensemble. Regards, Rakesh -----Original Message----- From: bit1129@163.com [mailto:bit1129@163.com]=20 Sent: 23 October 2014 08:46 To: user Subject: A question about sequential order consistency that zookeeper garan= tees Hi,Zookeepers, I'd like to ask a question about sequential order consistency that zookeepe= r garantees. Say, 2 zookeeper clients want to update the same znode data one after the o= ther.Client1 sends the request 1 second before Client2. What would be the end result? There is no order gurantee here, dure to netw= ork 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 d= oes sequential order consistencymeans, what does zookeeper exactly garantee= ? Thanks. bit1129@163.com