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 E2B603B6B for ; Fri, 6 May 2011 06:51:08 +0000 (UTC) Received: (qmail 66131 invoked by uid 500); 6 May 2011 06:51:08 -0000 Delivered-To: apmail-zookeeper-user-archive@zookeeper.apache.org Received: (qmail 66116 invoked by uid 500); 6 May 2011 06:51:08 -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 66108 invoked by uid 99); 6 May 2011 06:51:06 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 May 2011 06:51:06 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of ted.dunning@gmail.com designates 209.85.220.170 as permitted sender) Received: from [209.85.220.170] (HELO mail-vx0-f170.google.com) (209.85.220.170) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 May 2011 06:51:00 +0000 Received: by vxb40 with SMTP id 40so4293692vxb.15 for ; Thu, 05 May 2011 23:50:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-type; bh=ZtJM9zTdovZLommi8qdR4uc4IHCmd+Bg9COv++A108E=; b=tIQ7FdvrKgBwI0mZ8TJExAzZ+HD8cKieZrQHZHsGfye/IGlcSkCnT12Ogo9d5kOziG eT/bL0HiZQi3UQFLxZG92HW1rnJuWKAOBlWhCAq+ERtQM27GPqbZ8HW1rqUSRNrCpiSY dG5lxRmr4xmxttc8iYZAuHlXIK4Ep67BqkeA4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; b=MIhMV7Pq3V4ZuJOiaLa2fdkfM1gp81MZBAMInhRK03huUOT9ZK1jmJpdNvRvChiX28 I/JJezsp2DrnAWF/6kimkqByKTLvz1ZT/Xi1e4lhG+V2FzRAGXv4Ie11aiSU/NsuEdOm 0PACwo5wjbISKD4Er747WOleDbnuhsrXMTFCU= Received: by 10.52.176.10 with SMTP id ce10mr644193vdc.280.1304664639070; Thu, 05 May 2011 23:50:39 -0700 (PDT) MIME-Version: 1.0 Received: by 10.52.116.42 with HTTP; Thu, 5 May 2011 23:50:19 -0700 (PDT) In-Reply-To: References: From: Ted Dunning Date: Thu, 5 May 2011 23:50:19 -0700 Message-ID: Subject: Re: What is the order of read watch and write completion? To: user@zookeeper.apache.org Content-Type: multipart/alternative; boundary=bcaec51a81845ce37404a295e8f9 --bcaec51a81845ce37404a295e8f9 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable ZK provides strict and identical ordering of updates from the viewpoint of any particular client. Reads will always see versions of znodes that correspond to monotonically increasing changes. I am pretty (99%) sure tha= t interleaved reads and writes on the same machine will give consistent results from the point of view of that client. 2011/5/5 =E9=82=A2=E8=BF=AA=E4=BE=83 > *And from the perspective of the zk server, it handles the following two > change in the shown order: > a) /a changes to newA > b) /b changes to newB* > > Try to rephrase: > > In such order > > a) User U: create "/a" "oldA" > b) User U: create "/b" "oldB" > c) User S: read "/a" watch > d) User E: set "/a" "newA" > e) User F: set "/b" "newB" > f) User S: read "/b" > > In step f), user S either get "oldB" for "/b" (in case he connects to a > server that is a bit slow), or > firstly callback for "/a" is invoked with event CHANGED, and then getData= () > returns with "newB" for "/b". > From my understanding, this is guaranteed. > > My question is, if in step e) it is not another user F, but user S that s= et > "/b" to "newB", and from the perspective of the zk server, this write is > also followed by the write in step d) (so that /a is changed before > /b), does the zookeeper guarantee for user S to > > firstly get notified of watch set in step c) incurred by step d), and the= n > the write to "/b" completes (by "complete", I mean the setData() return, = or > for "aset", completion callback invoked). > > Thanks. > > XING Dikan > > 2011/5/6 Ted Dunning > > > This example seems a bit confused. > > > > If there is a watch on /b and /a is changed, then the watch on /b will > not > > be triggered. > > > > Can you rephrase your question? > > > > On Thu, May 5, 2011 at 8:47 PM, =E9=82=A2=E8=BF=AA=E4=BE=83 wrote: > > > > > Hi, All, > > > > > > I'm not sure whether the response (from the client perspective, the > > > completion callback or the return of a sync call) to a success write > > > (create, delete, etc) is also queued in the right place among read > > > completion and read watch. > > > > > > In detail, for example the current view is: > > > /a: oldA > > > /b: oldB > > > > > > And from the perspective of the zk server, it handles the following t= wo > > > change in the shown order: > > > a) /a changes to newA > > > b) /b changes to newB > > > > > > I understand, if Tom sets the read watch previously, before reading o= ut > > the > > > new content of "/b", Tom will get watch notification of "/a". > > > My question is if Tom is not reading, but writing. It is Tom that > changes > > > the content of /b. Then is there guarantee that the watch notificatio= n > of > > > "/a" will preceed the completion callback (if Tom asetData()) and the > > > return > > > of setData? > > > > > > In other words, will the server queue the response to the client's > write > > > request only after previous writes are locally played and triggered > > watches > > > are handled and queued into TCP sending tunnel? > > > Or say, is a success response to a write request a part of a consiste= nt > > > view > > > for a client? > > > > > > XING Dikan > > > > > > --bcaec51a81845ce37404a295e8f9--