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 0B321989F for ; Fri, 2 Mar 2012 19:24:06 +0000 (UTC) Received: (qmail 14268 invoked by uid 500); 2 Mar 2012 19:24:05 -0000 Delivered-To: apmail-zookeeper-user-archive@zookeeper.apache.org Received: (qmail 14214 invoked by uid 500); 2 Mar 2012 19:24:05 -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 14205 invoked by uid 99); 2 Mar 2012 19:24:05 -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 19:24:05 +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 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 19:23:57 +0000 Received: by pbcun1 with SMTP id un1so1372716pbc.15 for ; Fri, 02 Mar 2012 11:23:37 -0800 (PST) Received-SPF: pass (google.com: domain of amirhkiani@gmail.com designates 10.68.132.198 as permitted sender) client-ip=10.68.132.198; Authentication-Results: mr.google.com; spf=pass (google.com: domain of amirhkiani@gmail.com designates 10.68.132.198 as permitted sender) smtp.mail=amirhkiani@gmail.com; dkim=pass header.i=amirhkiani@gmail.com Received: from mr.google.com ([10.68.132.198]) by 10.68.132.198 with SMTP id ow6mr17711618pbb.161.1330716217437 (num_hops = 1); Fri, 02 Mar 2012 11:23:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:mime-version:content-type:subject:date:in-reply-to:to :references:message-id:x-mailer; bh=0rGW1llTTIxH4g4AKxHg8S8GIxSEoAwLiawuHUiuE9E=; b=mTP7F4jC8lGUz5jRrvmfj3VJTH6lBqLEdDule+acaC7eSw8Q3KcRvUTl8xcRGF9CJk AIuPLLzxqJ8JAFeS+6VeUq8qLHje/2RfA6nKCeg91Elyq4NvvYd4ZK0N1cklzhItr1jq Nz7e60fs/uXd1GAfywFseoNUTBL0Yu6ROJdOa3fOlDOySuWWegkxoswR0PJy8qXvfNtM uLFLnVLc3KHswFeu+IVBXqUDB20OGoBiLyq5MaEqj6A8Ub9vizxtCbTe7yvoWv9PdfYJ 9zo/sVtR06HUEP7Q2H7DdBWQYl8gDRf+53ghNGMb6ogOoe08vLGxq9tfk/fk3K86jfd3 jpCw== Received: by 10.68.132.198 with SMTP id ow6mr14699034pbb.161.1330716217323; Fri, 02 Mar 2012 11:23:37 -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 y9sm5731380pbi.3.2012.03.02.11.23.35 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 02 Mar 2012 11:23:35 -0800 (PST) From: Amirhossein Kiani Mime-Version: 1.0 (Apple Message framework v1251.1) Content-Type: multipart/alternative; boundary="Apple-Mail=_A1007F23-81CD-4CF4-8FBF-3A2CE2165B20" Subject: Re: Getting data after the watch Date: Fri, 2 Mar 2012 11:23:33 -0800 In-Reply-To: To: user@zookeeper.apache.org References: Message-Id: X-Mailer: Apple Mail (2.1251.1) X-Virus-Checked: Checked by ClamAV on apache.org --Apple-Mail=_A1007F23-81CD-4CF4-8FBF-3A2CE2165B20 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=iso-8859-1 Many thanks Patrick for pointing me to the new documentation. I just = found the other one from Google somehow. 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... Cheers, Amir On Mar 2, 2012, at 9:54 AM, Patrick Hunt wrote: > On Thu, Mar 1, 2012 at 4:11 PM, Amirhossein Kiani = wrote: >> Hi ZooKeepers, >=20 > Hi Amir. >=20 >> I just recently had an issue about getting the a node's updated data = after the watch was actually fired. Being pretty confused, I read the = documentation page again and sure enough this has been stated: >>=20 >> "A client will see a watch event for a znode it is watching before = seeing the new data that corresponds to that znode." >> http://zookeeper.apache.org/doc/r3.1.2/zookeeperProgrammers.html >>=20 >=20 > Those docs are pretty old. Try using the current version: > http://zookeeper.apache.org/doc/current/zookeeperProgrammers.html >=20 >> Now, I'm confused about how a data watch could actually be useful... = But aside from that, is this statement also true about the node's list = of Children? I.e. are a node's children it's "data" too? >>=20 >=20 > Watches let you know something changed. Then you can take actions. > Typically this means that the data of a znode changed, or the znode > itself changed (created/deleted, children added/removed). There are > two separate calls related to your question - getData and getChildren, > they set watches on the data an child list respectively. >=20 >> Because if this is the case, wouldn't the recipe for barriers hang if = it gets the watch for a new node addition goes off and in: >>=20 >> if (list.size() < size) { >> mutex.wait(); >>=20 >> list.size() is still smaller than size? >>=20 >> Or is this statement about watches only true for a data on the node? >=20 > No. It's true for both cases. If you set a data watch then it's > guaranteed that if you getData after being notified you will see the > updated data. Same for getChildren and it's child list. >=20 > Regards, >=20 > Patrick --Apple-Mail=_A1007F23-81CD-4CF4-8FBF-3A2CE2165B20--