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 ED9AA1009F for ; Thu, 18 Jul 2013 05:51:02 +0000 (UTC) Received: (qmail 66621 invoked by uid 500); 18 Jul 2013 05:51:01 -0000 Delivered-To: apmail-zookeeper-user-archive@zookeeper.apache.org Received: (qmail 66566 invoked by uid 500); 18 Jul 2013 05:50:51 -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 66551 invoked by uid 99); 18 Jul 2013 05:50:48 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Jul 2013 05:50:48 +0000 X-ASF-Spam-Status: No, hits=2.5 required=5.0 tests=FREEMAIL_REPLY,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of g.kishore@gmail.com designates 74.125.82.170 as permitted sender) Received: from [74.125.82.170] (HELO mail-we0-f170.google.com) (74.125.82.170) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Jul 2013 05:50:43 +0000 Received: by mail-we0-f170.google.com with SMTP id w57so2563670wes.29 for ; Wed, 17 Jul 2013 22:50:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=Ini6gBYVBqj7f5xDuoQsLZSVqfEuOB+z2mroo/tGXc8=; b=soe1vXgUm/AzE6zUjE5g2emE3c3W7233C/A94jBl8+FybJ8kF3pexncHfkNzgp2NE8 CwTzBk3EcFwxRoTweTVz4IK206W7JQB8oYLMydLhxXwJWZ2mbgpfxkb6Wlm3IY0ZKyp1 8NjTqIKHBNLKmauSVmNgzHepsy/CakXoQGg3RUAm5ino6SKsgpP6MvvbuRzx6nZ0n516 vop4V27hiaNs3f/VWkox85B1pGP82gL+7tE6cYQBwIkF8zW+VjOo/amuuH3SqqrO9o4/ CakwLWpvRncVNMBFf6NNVvy+U7BEeUQYNkd/g+RFb9XmnW7E5os5kP1+5X9tpEAdd8hk 4UTA== MIME-Version: 1.0 X-Received: by 10.194.24.40 with SMTP id r8mr7226439wjf.7.1374126622565; Wed, 17 Jul 2013 22:50:22 -0700 (PDT) Received: by 10.194.8.234 with HTTP; Wed, 17 Jul 2013 22:50:22 -0700 (PDT) In-Reply-To: References: <679FD55C-EDCC-4DA7-A757-76D5BA743CF1@yahoo.com> Date: Wed, 17 Jul 2013 22:50:22 -0700 Message-ID: Subject: Re: Watching children updates From: kishore g To: "user@zookeeper.apache.org" Content-Type: multipart/alternative; boundary=047d7b5d352836f6c804e1c2c90d X-Virus-Checked: Checked by ClamAV on apache.org --047d7b5d352836f6c804e1c2c90d Content-Type: text/plain; charset=ISO-8859-1 Good idea beware of failure scenarios. lets say you do #1. parent.setData #2 child.setData your watch might be triggered and when you read the children child may not be changed yet. so u will miss the child data change other option is #1 child.setData #2 parent.setData if you fail after setting the child data, there wont be any watch triggered. Only option is probably doing child.setData and parent.setData in the same transaction and probably the multitransaction can be helpful. But if you are updating children often the multitransaction might fail quite frequently because of concurrent updates on the parent I think its better for zk to solve this problem the right way. Instead of solving the problem of large number of watches in zk, it might be a better idea to add the concept of watching childDataChange in zookeeper. I dont think the implementation will be any more complicated than triggering watches for child creation. Thoughts ? On Wed, Jul 17, 2013 at 6:23 PM, Benjamin Jaton wrote: > Thanks, the JIRA is very interesting. > > I am contemplating the possibility to make a parent.setData(..) call to > notify of a change in one of the children and put a watcher on > parent.getData(). > I would then iterate through the children and compare the stat.getVersion() > to figure out which have changed. > > > On Wed, Jul 17, 2013 at 5:30 PM, Flavio Junqueira >wrote: > > > Hi Ben, > > > > Your description seems right to me, assuming that when you refer to > > changes to the children, you mean setting the data of the children. > > > > You may also want to have a look here if you haven't done it yet: > > > > > > > http://zookeeper.apache.org/doc/r3.4.5/zookeeperProgrammers.html#ch_zkWatches > > > > About performance impact, you may want to have a look at the discussion > > here: > > > > https://issues.apache.org/jira/browse/ZOOKEEPER-1177 > > > > -Flavio > > > > On Jul 18, 2013, at 12:25 AM, Benjamin Jaton > > wrote: > > > > > Hello, > > > > > > I would like to be notified of a change on any of the children of a > znode > > > (could be a lot of them). > > > > > > AFAIK to achieve this we need to set a watcher on each child and then > > also > > > watch the parent to be aware of children addition/deletion and > add/remove > > > watchers accordingly. Is that correct? > > > > > > What is the performance impact of having for example thousands of > > watchers? > > > > > > Thanks, > > > Ben > > > > > --047d7b5d352836f6c804e1c2c90d--