hadoop-zookeeper-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Patrick Hunt <ph...@apache.org>
Subject Re: Updated NodeWatcher...
Date Fri, 09 Jan 2009 17:37:15 GMT
Ben this is great, thanks! Do you want to close out this one and point 
to the faq?


Although IMO this should be moved to the forrest docs.


Benjamin Reed wrote:
> I'm really bad a creating figures, but i've put up something that should be informative.
(i'm also really bad at apache wiki.) hopefully someone can make it more beautiful. i've added
the state diagram to the FAQ: http://wiki.apache.org/hadoop/ZooKeeper/FAQ
> ben
> -----Original Message-----
> From: adam.rosien@gmail.com [mailto:adam.rosien@gmail.com] On Behalf Of Adam Rosien
> Sent: Thursday, January 08, 2009 8:06 PM
> To: zookeeper-user@hadoop.apache.org
> Subject: Re: Updated NodeWatcher...
> It feels like we need a flowchart, state-chart, or something, so we
> can all talk about the same thing. Then people could suggest
> abstractions that would essentially put a box around sections of the
> diagram. However I feel woefully inadequate at the former :(.
> .. Adam
> On Thu, Jan 8, 2009 at 4:20 PM, Benjamin Reed <breed@yahoo-inc.com> wrote:
>> For your first issue if an ensemble goes offline and comes back, everything should
be fine. it will look to the client just like a server went down. if a session expires, you
are correct that the client will not reconnect. this again is on purpose. for the node watcher
the session is unimportant, but if the ZooKeeper object is also being used for leader election,
for example, you do not want the object to grab a new session automatically.
>> For 2) i think pat responded to that one. an async request will always return. if
the server goes down after the request is issued, you will get a connection loss error in
your callback.
>> Your third issued is described with the first.
>> ben
>> -----Original Message-----
>> From: burtonator@gmail.com [mailto:burtonator@gmail.com] On Behalf Of Kevin Burton
>> Sent: Thursday, January 08, 2009 4:02 PM
>> To: zookeeper-user@hadoop.apache.org
>> Subject: Re: Updated NodeWatcher...
>>> i just found that part of this thread went to my junk folder. can you send
>>> the URL for the NodeListener?
>> Sure... here you go:
>> http://pastebin.com/f1e9d3706
>>> this NodeWatcher is a useful thing. i have a couple of suggestions to
>>> simplify it:
>>> 1) Construct the NodeWatcher with a ZooKeeper object rather than
>>> constructing one. Not only does it simplify NodeWatcher, but it also makes
>>> it so that the ZooKeeper object can be used for other things as well.
>> I hear you.... I was thinking that this might not be a good idea because
>> NodeWatcher can reconnect you to the ensemble if it goes offline.
>> I'm not sure if it's a bug or not but once my session expired on the client
>> it wouldn't reconnect so I just implemented my own reconnect and session
>> expiry.
>>> 2) Use the async API in watchNodeData and watchNodeExists. it simplifies
>>> the code and the error handling.
>> The problem was that according to feedback here an async request might never
>> return if the server dies shortly after the request and before it has a
>> change to respond.
>> I wanted NodeWatcher to hide as much rope as possible.
>>> 3) You don't need to do a connect() in handleDisconnected(). ZooKeeper
>>> object will do it automatically for you.
>> I can try again if you'd like by this isn't my experience.  Once the session
>> expired and the whole ensemble was offline it wouldn't connect again.
>> If it was a transient disconnect I'd see on disconnect event and then a
>> quick reconnect.  If it was a long disconnect (with nothing to attach to)
>> then ZK won't ever reconnect me.
>> I'd like this to be the behavior though...
>>> There is an old example on sourceforge
>>> http://zookeeper.wiki.sourceforge.net/ZooKeeperJavaExample that may give
>>> you some more ideas on how to simplify your code.
>> That would be nice.... simple is good!
>> Kevin
>> --
>> Founder/CEO Spinn3r.com
>> Location: San Francisco, CA
>> AIM/YIM: sfburtonator
>> Skype: burtonator
>> Work: http://spinn3r.com

View raw message