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 0C9E01050A for ; Tue, 28 Apr 2015 22:52:19 +0000 (UTC) Received: (qmail 17514 invoked by uid 500); 28 Apr 2015 22:52:18 -0000 Delivered-To: apmail-zookeeper-user-archive@zookeeper.apache.org Received: (qmail 17465 invoked by uid 500); 28 Apr 2015 22:52:18 -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 17448 invoked by uid 99); 28 Apr 2015 22:52:18 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 Apr 2015 22:52:18 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: message received from 54.191.145.13 which is an MX secondary for user@zookeeper.apache.org) Received: from [54.191.145.13] (HELO mx1-us-west.apache.org) (54.191.145.13) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 Apr 2015 22:52:13 +0000 Received: from relayvx11a.securemail.intermedia.net (relayvx11a.securemail.intermedia.net [64.78.56.46]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with ESMTPS id D149C2735B for ; Tue, 28 Apr 2015 22:51:52 +0000 (UTC) Received: from securemail.intermedia.net (localhost [127.0.0.1]) by emg-ca-1-1.localdomain (Postfix) with ESMTP id 81FF153E75 for ; Tue, 28 Apr 2015 15:51:52 -0700 (PDT) Subject: Re: List Watches of a node MIME-Version: 1.0 x-echoworx-emg-received: Tue, 28 Apr 2015 15:51:52.472 -0700 x-echoworx-msg-id: f59bfc5a-dbda-40a4-b1eb-4832935b3007 x-echoworx-action: delivered Received: from emg-ca-1-1.securemail.intermedia.net ([10.254.155.11]) by emg-ca-1-1 (JAMES SMTP Server 2.3.2) with SMTP ID 7 for ; Tue, 28 Apr 2015 15:51:52 -0700 (PDT) Received: from MBX080-W4-CO-2.exch080.serverpod.net (unknown [10.224.117.102]) by emg-ca-1-1.localdomain (Postfix) with ESMTP id 43A8B53E75 for ; Tue, 28 Apr 2015 15:51:52 -0700 (PDT) Received: from MBX080-W4-CO-2.exch080.serverpod.net (10.224.117.102) by MBX080-W4-CO-2.exch080.serverpod.net (10.224.117.102) with Microsoft SMTP Server (TLS) id 15.0.1044.25; Tue, 28 Apr 2015 15:51:51 -0700 Received: from MBX080-W4-CO-2.exch080.serverpod.net ([10.224.117.102]) by mbx080-w4-co-2.exch080.serverpod.net ([10.224.117.102]) with mapi id 15.00.1044.021; Tue, 28 Apr 2015 15:51:51 -0700 From: Chris Nauroth To: "user@zookeeper.apache.org" Thread-Topic: List Watches of a node Thread-Index: AQHQgcIFh7/a5yKBYE6KSogOALaiq51jAF8A//+ZMQCAAHwsgP//8pKA Date: Tue, 28 Apr 2015 22:51:50 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [50.248.208.113] x-source-routing-agent: Processed Content-Type: text/plain; charset="iso-8859-1" Content-ID: <2B2E73DBB1307649AF052D1EF15225A9@exch080.serverpod.net> Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org If you're seeing a non-zero zk_watch_count from mntr, but no watch information from wchs, wchp and wchc, then it's likely that the client applications connecting to the ZooKeeper cluster are implemented to set child watches, not data watches. If you have access to the client application code, then you can confirm this by looking at the ZooKeeper calls. Data watches are set in calls to ZooKeeper#exists or ZooKeeper#getData. Child watches are set in calls to ZooKeeper#getChildren. Your original email mentioned that the client watches ephemeral nodes. I'm guessing that the client's logic is to set a watch by calling getChildren on a parent node, like /parent, into which other processes create their ephemeral nodes, like /parent/ephemeral1, /parent/ephemeral2, etc. If that is the case, then this is a child watch. The current implementation of mntr counts both data watches and child watches towards zk_watch_count. wchs, wchp and wchc are only looking at data watches. ZOOKEEPER-1274 tracks the work of changing the ZooKeeper code to include child watches in the output of wchs, wchp and wchc. Unfortunately, I'm not aware of any other easy way to get this information for child watches. --Chris Nauroth On 4/28/15, 9:39 AM, "B. Heath Robinson" wrote: >Thanks. I ran into these, but they don't seem to working as I expected. >For example: > >hrobinson@fortress:~$ echo mntr |nc 10.1.0.172 2181 >zk_version 3.4.6-1569965, built on 02/20/2014 09:09 GMT >zk_avg_latency 0 >zk_max_latency 441 >zk_min_latency 0 >zk_packets_received 28675194 >zk_packets_sent 28674836 >zk_num_alive_connections 153 >zk_outstanding_requests 0 >zk_server_state follower >zk_znode_count 1580 >zk_watch_count 147 >zk_ephemerals_count 129 >zk_approximate_data_size 274629 >zk_open_file_descriptor_count 183 >zk_max_file_descriptor_count 4096 >hrobinson@fortress:~$ echo wchp|nc 10.1.0.172 2181 > >hrobinson@fortress:~$ > >My cluster does have 7 members, and the way I read the docs for wchp, it >only returns watches on that server, so I did the same wchp for all 7 >members, and I get nothing. > > >On Tue, Apr 28, 2015 at 11:17 AM Chris Nauroth >wrote: > >> One thing to keep in mind is that the wchs, wchp and wchc commands >> currently return information only about data change watches (Watcher >> instances passed to ZooKeeper#exists or ZooKeeper#getData). These >> commands will not return information about child watches (Watcher >> instances passed to ZooKeeper#getChildren). ZOOKEEPER-1274 is an open >> issue tracking enhancements to these commands to support returning >> information about child watches too. >> >> https://issues.apache.org/jira/browse/ZOOKEEPER-1274 >> >> >> --Chris Nauroth >> >> >> >> >> On 4/28/15, 8:23 AM, "S=E9kine Coulibaly" wrote: >> >> >The four letters command can be of some help here : >> > >> >echo "wchp" | nc localhost 2181 >> > >> >Do you need access from a Java or C API ? >> > >> >Reference: >> > >>=20 >>http://zookeeper.apache.org/doc/trunk/zookeeperAdmin.html#The+Four+Letter >>+ >> >Words >> > >> > >> >2015-04-28 16:45 GMT+02:00 B. Heath Robinson : >> > >> >> I have a system where a client watches ephemeral nodes. I would like >> >>to be >> >> able to know if there are any watches for a node. Is there any way >>to >> >>do >> >> this? >> >> >> >>