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
>
|