zookeeper-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Qian Ye <yeqian....@gmail.com>
Subject Re: need for more conditional write support
Date Fri, 10 Dec 2010 08:01:25 GMT
Hi Ted:

The solution you mentioned works in some situation, but not mine. Because,
in the third step, after you checking the condition on B and C, the value on
B and C still might be modified before you update value on A. The key point
is that with the current ZK primitives, you cannot lock node A when u are
updating node B.

A possible solution based on current ZK primitives for this scenario is that
create a extra node for each data node to play as the lock. So the update on
A can be protected by this kind of lock. However, this implementation will
bring in much complexity. For example, how to prevent deadlock in some
abnormal situations.

What's more, I think this kind of conditional write support is simpler than
multiple transactions. Multiple transactions can be built with this kind of
support. The link is broken?

On Fri, Dec 10, 2010 at 7:33 AM, Ted Dunning <ted.dunning@gmail.com> wrote:

> Qian,
> Depending on your situation, you can implement something like this now with
> the ZK primitives.
> In particular,
>    - get the current version v_a of A
>    - test the values of B and C
>    - if the condition on B and C is met, update A with required version v_a
> You may want to retry the whole thing if you get an exception on the update
> of A.
> This does a safe test and set operation, but does not allow for the
> potential of atomically updating multiple znodes in one operation.  A
> special case solution to that is to put all objects that may need to be
> updated together in the same znode content.  That is clearly not a general
> solution, but it is often possible.
> On Thu, Dec 9, 2010 at 4:19 AM, Qian Ye <yeqian.zju@gmail.com> wrote:
> > Hi all:
> >
> > I'm working on a distributed system these days, and need more conditional
> > write support on Zookeeper. Now the zookeeper only support modifing,
> delete
> > or set, node data with a version number represent the current version of
> > the
> > node. I need modification on the condition of other nodes. For e.g. I
> want
> > to set the node data of /node to A, if the node data of /node1 is B and
> the
> > node data of /node2 is C. Should we support this kind of interface?
> >
> > thanks
> > --
> > With Regards!
> >
> > Ye, Qian
> >

With Regards!

Ye, Qian

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message