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 CDA2CC77A for ; Sat, 19 May 2012 21:31:47 +0000 (UTC) Received: (qmail 53147 invoked by uid 500); 19 May 2012 21:31:45 -0000 Delivered-To: apmail-zookeeper-user-archive@zookeeper.apache.org Received: (qmail 53083 invoked by uid 500); 19 May 2012 21:31:45 -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 53072 invoked by uid 99); 19 May 2012 21:31:45 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 19 May 2012 21:31:45 +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 bitanarch@gmail.com designates 74.125.82.46 as permitted sender) Received: from [74.125.82.46] (HELO mail-wg0-f46.google.com) (74.125.82.46) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 19 May 2012 21:31:37 +0000 Received: by wgbdq10 with SMTP id dq10so3520371wgb.15 for ; Sat, 19 May 2012 14:31:17 -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=xP5h5WZAVvDR4FTW3O2mKc9OPn7kLH3MBL5UxYkO4mE=; b=GkltDByWlX/yT+hhEFMO75XoFTCJnc53B6NOempBsGMKWTNiKVHNhzURN+CnYNe9U9 UpwSpgi2VT5hQ9Sex2fbM125NPgXXsDhzZAhZ2p6TzHRWVnKYYaI+qHIPO8fGZZ3J8Dk peIWvUOhsOfBQbdlMm98DkfBFcuxsqE/dxHereTuldbuoP7pAROJHHGlsEm+mCGXdSnq Goor68lREU+L1tzU60jG6PaTqEQz42qdbGhuQRlWlW0NWrYY145kfgzmBPLzVTIjroXh ilFiB7UfsqYN9kzN1FRKpEQ5kM6ks49jomhRZPN2IjdjS/mUCxaSykaRsB3TI4OvMql+ lfkw== MIME-Version: 1.0 Received: by 10.180.98.201 with SMTP id ek9mr12180258wib.7.1337463076969; Sat, 19 May 2012 14:31:16 -0700 (PDT) Received: by 10.216.206.144 with HTTP; Sat, 19 May 2012 14:31:16 -0700 (PDT) In-Reply-To: References: Date: Sat, 19 May 2012 14:31:16 -0700 Message-ID: Subject: Re: How to recover previous watcher & event after "session expired" From: Martin Kou To: user@zookeeper.apache.org Content-Type: multipart/alternative; boundary=f46d04428edc9a5ca404c06a6331 --f46d04428edc9a5ca404c06a6331 Content-Type: text/plain; charset=GB2312 Content-Transfer-Encoding: quoted-printable Correct. And even simple connection losses can cause watches to become unreliable as well: http://zookeeper.apache.org/doc/trunk/releasenotes.html#Watch+Management "One caveat to the watch management: it is possible to miss an event for the creation and deletion of a znode if watching for creation and both the create and delete happens while the client is disconnected from ZooKeeper." Best Regards, Martin Kou On Fri, May 18, 2012 at 8:33 PM, =C0=EE=BA=D5=D4=AA = wrote: > Thanks for your help. > That means we can't totally rely on watchs because it may loss event if > session expired, right? > > =D4=DA 2012=C4=EA5=D4=C219=C8=D5=D0=C7=C6=DA=C1=F9=A3=ACCamille Fournier = =D0=B4=B5=C0=A3=BA > > I'm not sure what you mean in question #1. A session expired event > > generally causes the client to become completely invalid, you could > > wrap the client in your own logic to record what you were watching, > > but I don't think you can get that out of the client after it's > > expired. > > > > 2. You won't be able to see events that happened when the session was > > expired. The server has closed your connection and won't know to send > > you events unless you have a valid session with a valid watch. > > > > 3. Reconnect won't work on expired sessions, you need to create an > > entirely new session. Reconnect works when you get disconnected but > > not expired. > > > > Hope that helps > > On Fri, May 18, 2012 at 12:18 PM, =C0=EE=BA=D5=D4=AA wrote: > >> Hi, All > >> > >> I'm dealing with the case of "session expired" event. Please help me > >> with the following question. > >> > >> 1. After receive "session expired" event, how to recover the watch > >> that are setting before expired gracefully? > >> > >> > >> 2.Currently, I record the watch setting and call the api to set it > >> again after I got "expired event". It will callback for event after > >> connection was success again. But what about the event happend between > >> I success reinit the session to zk server. Currently, it got lost. Is > >> there any way that I can got these events ? > >> > >> > >> 3.I try to use reconnect, in zookeeper_init, but does't work. My guess > >> is reconnect is only work for connection that are in state connect > >> (Not valid after session timeout), is it right? > >> > >> > >> Thanks for your help ! > > > --f46d04428edc9a5ca404c06a6331--