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 26C1D9257 for ; Fri, 2 Mar 2012 23:33:59 +0000 (UTC) Received: (qmail 98124 invoked by uid 500); 2 Mar 2012 23:33:58 -0000 Delivered-To: apmail-zookeeper-user-archive@zookeeper.apache.org Received: (qmail 98096 invoked by uid 500); 2 Mar 2012 23:33:58 -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 98088 invoked by uid 99); 2 Mar 2012 23:33:58 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 02 Mar 2012 23:33:58 +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 (nike.apache.org: domain of amirhkiani@gmail.com designates 209.85.160.42 as permitted sender) Received: from [209.85.160.42] (HELO mail-pw0-f42.google.com) (209.85.160.42) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 02 Mar 2012 23:33:50 +0000 Received: by pbcun1 with SMTP id un1so1534625pbc.15 for ; Fri, 02 Mar 2012 15:33:29 -0800 (PST) Received-SPF: pass (google.com: domain of amirhkiani@gmail.com designates 10.68.72.138 as permitted sender) client-ip=10.68.72.138; Authentication-Results: mr.google.com; spf=pass (google.com: domain of amirhkiani@gmail.com designates 10.68.72.138 as permitted sender) smtp.mail=amirhkiani@gmail.com; dkim=pass header.i=amirhkiani@gmail.com Received: from mr.google.com ([10.68.72.138]) by 10.68.72.138 with SMTP id d10mr20261773pbv.15.1330731209229 (num_hops = 1); Fri, 02 Mar 2012 15:33:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:mime-version:content-type:from:in-reply-to:date:cc :message-id:references:to:x-mailer; bh=6XHDlM3Xi9KRjSHUSPmdUSINl+98KuVrv8kC98hMVGA=; b=KUOgOoJOfVpbmcHIr/U3l0OoBCTKym/d2l4JvVHoRJXL8vHnSHjocfSvuUHeTCcJCK sGzNwR1gWMmdmtivuw2/MWMto0IleaKLmm34UOZVerWdg9lBLG+dAKef7GMTZckEdGgb d0wbs5A/R5LU+PfGvWiufe942TWBPmDeKH4c0YnqNZZv7YbH/zA0nk25hdL0fLJH7AHP cAYG0HAipy0JPFidF13930VjiqSJz2lIo94JkbKiN4FUFTPmHT1OdcwqaTndmuhpm72t qP41B+Az0sNb8nyn29CnBE2QZq76yU6nBCDjOaZZojhhmGOvopnZefPT36+BrPT4WW5O AMpw== Received: by 10.68.72.138 with SMTP id d10mr16911146pbv.15.1330731209137; Fri, 02 Mar 2012 15:33:29 -0800 (PST) Received: from amiroo.localnet (50-78-98-94-static.hfc.comcastbusiness.net. [50.78.98.94]) by mx.google.com with ESMTPS id z10sm6170158pbq.55.2012.03.02.15.33.26 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 02 Mar 2012 15:33:28 -0800 (PST) Subject: Re: Getting data after the watch Mime-Version: 1.0 (Apple Message framework v1251.1) Content-Type: multipart/alternative; boundary="Apple-Mail=_25A44D5C-61D1-40AD-8206-89A5E4E8BF0A" From: Amirhossein Kiani In-Reply-To: Date: Fri, 2 Mar 2012 15:33:25 -0800 Cc: Patrick Hunt Message-Id: <773AC303-A474-473E-B05A-B4288CEC74DE@gmail.com> References: <9D6A630B-92C0-4D27-A5DA-FA41E32BD5A1@gmail.com> To: user@zookeeper.apache.org X-Mailer: Apple Mail (2.1251.1) X-Virus-Checked: Checked by ClamAV on apache.org --Apple-Mail=_25A44D5C-61D1-40AD-8206-89A5E4E8BF0A Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Oh.. you are right. The value was skipped because I was getting two of = some values (newer but not older) So I should restructure my code to not make decisions that rely on locks = created based on node data (unless I come up with a way to sync the = state myself :D) I think I'll implement that by creating a chain of = children instead. The statement about getting every value exactly once is not correct = though, because I do get some values twice (when one is skipped) Thanks a lot! Amir On Mar 2, 2012, at 2:52 PM, Ted Dunning wrote: > I don't think that your test tests what you think it tests. >=20 > You won't necessarily get a notification every time a value changes. = If a > value changes and a watch is queued, you won't get another = notification > until you get the data and set the new watch. If another change = happens > before you reset the watch, you will get the second changed value, not = the > first. With your test, you will see a skipped value in your table and > conclude that you saw an old value twice. The correct inference is = that > you saw every value exactly once except the skipped one. >=20 > On Fri, Mar 2, 2012 at 1:58 PM, Amirhossein Kiani = wrote: >=20 >> Hmm... I tried testing the idea that if I call the getData() on = updated >> node in the watcher's process() method I'll get the updated data. >> I created a watcher class that keeps track of the values it's = receiving >> and in my test I sequentially set 10000 values on the node. I do see = that >> some times I'm getting the OLD VALUE. >>=20 >> I wonder if the way I'm setting the data or getting it is incorrect. >>=20 >> Here are the main files in my test: >> https://gist.github.com/1961660 >>=20 >> You can run my test by running "mvn test" in the maven project = attached. >>=20 >>=20 >>=20 >> Many thanks for your help! >> Amir >>=20 >> On Mar 2, 2012, at 11:27 AM, Patrick Hunt wrote: >>=20 >> On Fri, Mar 2, 2012 at 11:23 AM, Amirhossein Kiani = >> wrote: >>=20 >> Many thanks Patrick for pointing me to the new documentation. I just = found >> the other one from Google somehow. >>=20 >>=20 >>=20 >> No problem. >>=20 >> So what I think is happening is actually impossible: to do getData() = on a >> node and see the OLD data. in other words, I do not need to loop on a >> getData() to get the actual new data after being notified about the = data >> change. >>=20 >> The reason that I'm saying that is that's the behavior I'm seeing in = my >> code, but it might be just a bug on my side... >>=20 >>=20 >> Sounds like. Keep in mind that there might be multiple changes btw = the >> time the notification fires and when your getData runs on the server. >> Perhaps someone's changing it back? :-) >>=20 >> Patrick >>=20 >>=20 >>=20 >>=20 --Apple-Mail=_25A44D5C-61D1-40AD-8206-89A5E4E8BF0A--