Your attached picture didn't make it to the mailing list. And I suppose
that you mean that a node is "active" if it's online and connected to ZK,
right? If my assumptions are right then you can create an ephemeral node
for each node, for example, /v1/active-node1 and /v2/active-node2. If one,
or even both, of the nodes goes offline then its corresponding ephemeral
node will be deleted by ZK once the session associated with that connection
expires (~2 secs). Hope this helps.
On Wed, Nov 13, 2013 at 5:23 AM, Techy Teck <[EMAIL PROTECTED]> wrote:
> Suppose I have this hierarchy in my zookeeper schema. Attached is the
> And there will be some children for /v1 and /v2 as well.
> At some stage, I will be trying to retrieve children of /root parent node.
> And depending on whether /v1 is active or /v2 is active, we will retrieve
> its children.
> Suppose if /v1 is active, then we will retrieve children of v1 and if v2
> is active, then we will retrieve children of v2.
> Now I am wondering, how to add this active(ness) as a part of znode?
> Meaning how to make sure any one node is active at certain point so that
> when I retrieve the children of root, I can tell which version is active
> and then get the children of those version (v1 or v2) node
> Initially, I was thinking to add some data in /v1 and /v2 node which will
> tell us which node is active from v1 and v2.
> But is there any other approach that I can use here?