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 8CA799DCB for ; Fri, 2 Mar 2012 22:53:15 +0000 (UTC) Received: (qmail 4890 invoked by uid 500); 2 Mar 2012 22:53:15 -0000 Delivered-To: apmail-zookeeper-user-archive@zookeeper.apache.org Received: (qmail 4863 invoked by uid 500); 2 Mar 2012 22:53:15 -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 4855 invoked by uid 99); 2 Mar 2012 22:53:14 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 02 Mar 2012 22:53:14 +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 ted.dunning@gmail.com designates 209.85.214.170 as permitted sender) Received: from [209.85.214.170] (HELO mail-tul01m020-f170.google.com) (209.85.214.170) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 02 Mar 2012 22:53:10 +0000 Received: by obbwd1 with SMTP id wd1so2547865obb.15 for ; Fri, 02 Mar 2012 14:52:49 -0800 (PST) Received-SPF: pass (google.com: domain of ted.dunning@gmail.com designates 10.182.12.74 as permitted sender) client-ip=10.182.12.74; Authentication-Results: mr.google.com; spf=pass (google.com: domain of ted.dunning@gmail.com designates 10.182.12.74 as permitted sender) smtp.mail=ted.dunning@gmail.com; dkim=pass header.i=ted.dunning@gmail.com Received: from mr.google.com ([10.182.12.74]) by 10.182.12.74 with SMTP id w10mr4592164obb.51.1330728769477 (num_hops = 1); Fri, 02 Mar 2012 14:52:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=0fGXQzZGRqJjPVQcwYrdJ/HwTgTEpaswva5DiU1Y4TA=; b=pQMf3MY3jQIVHAnVj5a6Kjw2alYDIbwFauIDi9aaL9TVpP5i9fp1TY+ncoYl8JIOsd oQdY4Hrem9LdlRRGizqCdqIURFB1qWV9pW5J6fVKx0m6f+2kqgBcx8wCgH9VlJgI0cId gipu9y3hUZwy/mjR3QHIvfAitWoxXNwYR5cAygW/VAvd3Cd52yNGye7lTfvG5UYqMNl8 hWRMvWbwDpz8XCVHpNFQ7CNmQBDFttv1bTaZnEZ7ZKV8FXyfbq/ke1/1+uRNOIpyspFN bFiXJWMKKBdLZz5HOumlTmM+WOTbsJE4G9tbUre/X32dZD+zUDTJEyf0plkikxh8RDMK xBpQ== Received: by 10.182.12.74 with SMTP id w10mr3963309obb.51.1330728769349; Fri, 02 Mar 2012 14:52:49 -0800 (PST) MIME-Version: 1.0 Received: by 10.182.116.33 with HTTP; Fri, 2 Mar 2012 14:52:19 -0800 (PST) In-Reply-To: <9D6A630B-92C0-4D27-A5DA-FA41E32BD5A1@gmail.com> References: <9D6A630B-92C0-4D27-A5DA-FA41E32BD5A1@gmail.com> From: Ted Dunning Date: Fri, 2 Mar 2012 14:52:19 -0800 Message-ID: Subject: Re: Getting data after the watch To: user@zookeeper.apache.org Cc: Patrick Hunt Content-Type: multipart/alternative; boundary=f46d044468db96e82204ba4a6ff5 X-Virus-Checked: Checked by ClamAV on apache.org --f46d044468db96e82204ba4a6ff5 Content-Type: text/plain; charset=UTF-8 I don't think that your test tests what you think it tests. 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. On Fri, Mar 2, 2012 at 1:58 PM, Amirhossein Kiani wrote: > 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. > > I wonder if the way I'm setting the data or getting it is incorrect. > > Here are the main files in my test: > https://gist.github.com/1961660 > > You can run my test by running "mvn test" in the maven project attached. > > > > Many thanks for your help! > Amir > > On Mar 2, 2012, at 11:27 AM, Patrick Hunt wrote: > > On Fri, Mar 2, 2012 at 11:23 AM, Amirhossein Kiani > wrote: > > Many thanks Patrick for pointing me to the new documentation. I just found > the other one from Google somehow. > > > > No problem. > > 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. > > 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... > > > 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? :-) > > Patrick > > > > --f46d044468db96e82204ba4a6ff5--