You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@zookeeper.apache.org by Mudit Verma <mu...@gmail.com> on 2014/07/01 18:25:46 UTC

Struct Stat version and cversion

Hi All, 

Here is what I want to do. 

Delete a znode atomically if it does not any more children. 

1. Get stats 
2. if (stats->num_children == 0)
	delete(if the version is same && cversion is same)


Does version of a znode also reflects changes to its children?  From documentation:
version
The number of changes to the data of this znode.
cversion
The number of changes to the children of this znode.


The problem is, delete api accept version but does not accept cversion. 

Any idea how can I do it?

Thanks
Mudit

Re: Struct Stat version and cversion

Posted by Vamsi Devaki <de...@gmail.com>.
If child nodes were created after your check, Delete fails with
KeeperException.NotEmpty.

Regards,
Vamsi

On Tue, Jul 1, 2014 at 9:25 AM, Mudit Verma <mu...@gmail.com> wrote:
> Hi All,
>
> Here is what I want to do.
>
> Delete a znode atomically if it does not any more children.
>
> 1. Get stats
> 2. if (stats->num_children == 0)
>         delete(if the version is same && cversion is same)
>
>
> Does version of a znode also reflects changes to its children?  From documentation:
> version
> The number of changes to the data of this znode.
> cversion
> The number of changes to the children of this znode.
>
>
> The problem is, delete api accept version but does not accept cversion.
>
> Any idea how can I do it?
>
> Thanks
> Mudit



-- 
Vamsi