zookeeper-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Gamache <gama...@cabotresearch.com>
Subject Re: Multi question on using previous ops results
Date Sun, 20 May 2012 12:39:38 GMT

As far as I can tell, the "under construction" approach will let me do 
everything I need!   Thanks - that is a simple and elegant approach that 
I probably should have known about, at least I know now....

On 5/18/2012 8:03 PM, Ted Dunning wrote:
> On Fri, May 18, 2012 at 1:55 PM, Joe Gamache<gamache@cabotresearch.com>wrote:
>> ...
>> I have a one process that is trying to create some "work" that will be
>> represented via a ZNode.   A large number of other processes are looking
>> for work.   The node that represents the work will be sequential.  Most
>> importantly, it will be incomplete until the structure below it is
>> completed.
> That is easy.  Just create the lower structures first.  If the upper
> structure needs to have an indicator that it is under construction, just
> set a bit inside it using the atomic update method.  Or create a separate
> node to do leader election.
>> Thus, I would like to be able to create that node and lock it atomically
>> OR create the entire structure below it atomically.
> Remember ZK doesn't do locks.
> You can create the node with the "under-construction" bit set.   Or you can
> use a multi to create the parent and children simultaneously.   You can
> create the parent with references to a version in another node by getting
> the version of the parent, getting the versions of the children, updating
> the parent with the version specified.  Retry with backoff on failure.
> I would like to avoid hacking in another parallel node structure solely for
>> the purpose of locking (as there will be many 1000's of these created)
> As you like.  This can be handled pretty easily.  Setting watches on the
> release of a node is a bit trickier, but can be handled as well.
>> All I am really wondering is can Zookeeper do this?   If not, I can find
>> alternate ways around - they just seem less elegant to me.
> It can.

View raw message