You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@curator.apache.org by Techy Teck <co...@gmail.com> on 2013/11/13 08:35:47 UTC

Delete all the child nodes within parent node?

Is there any way to delete all the child nodes of any parent node
recursively using curator?

        CuratorFramework client =
CuratorClient.createSimple("localhost:2181");
        client.start();

        client.delete().forPath("/foo");


I have couple of children node inside /foo parent node. So is there any way
to delete all the child nodes recursively within any parent node using
Curator library?

This is what I get -

Exception in thread "main"
org.apache.zookeeper.KeeperException$NotEmptyException: KeeperErrorCode =
Directory not empty for /foo

Re: Delete all the child nodes within parent node?

Posted by Cameron McKenzie <mc...@gmail.com>.
Thanks Jordan,
I missed this fix in the latest release.
cheers
Cam


On Fri, Nov 15, 2013 at 1:03 PM, Jordan Zimmerman <
jordan@jordanzimmerman.com> wrote:

> CURATOR-30 added a recursive delete method:
>
> client.delete().deletingChildrenIfNeeded()…
>
> -Jordan
>
> On Nov 13, 2013, at 12:21 AM, Cameron McKenzie <mc...@gmail.com>
> wrote:
>
> There's no way to do this in Curator currently that I'm aware of. You'd
> have to implement a recursive function to query and delete child nodes
> before deleting the parent node.
>
>
> On Wed, Nov 13, 2013 at 6:35 PM, Techy Teck <co...@gmail.com>wrote:
>
>> Is there any way to delete all the child nodes of any parent node
>> recursively using curator?
>>
>>         CuratorFramework client =
>> CuratorClient.createSimple("localhost:2181");
>>         client.start();
>>
>>         client.delete().forPath("/foo");
>>
>>
>> I have couple of children node inside /foo parent node. So is there any
>> way to delete all the child nodes recursively within any parent node using
>> Curator library?
>>
>> This is what I get -
>>
>> Exception in thread "main"
>> org.apache.zookeeper.KeeperException$NotEmptyException: KeeperErrorCode =
>> Directory not empty for /foo
>>
>
>
>

Re: Delete all the child nodes within parent node?

Posted by Jordan Zimmerman <jo...@jordanzimmerman.com>.
CURATOR-30 added a recursive delete method:

client.delete().deletingChildrenIfNeeded()…

-Jordan

On Nov 13, 2013, at 12:21 AM, Cameron McKenzie <mc...@gmail.com> wrote:

> There's no way to do this in Curator currently that I'm aware of. You'd have to implement a recursive function to query and delete child nodes before deleting the parent node.
> 
> 
> On Wed, Nov 13, 2013 at 6:35 PM, Techy Teck <co...@gmail.com> wrote:
> Is there any way to delete all the child nodes of any parent node recursively using curator?
> 
>         CuratorFramework client = CuratorClient.createSimple("localhost:2181");
>         client.start();
>         
>         client.delete().forPath("/foo");
> 
> 
> I have couple of children node inside /foo parent node. So is there any way to delete all the child nodes recursively within any parent node using Curator library?
> 
> This is what I get - 
> 
> Exception in thread "main" org.apache.zookeeper.KeeperException$NotEmptyException: KeeperErrorCode = Directory not empty for /foo
> 


Re: Delete all the child nodes within parent node?

Posted by Cameron McKenzie <mc...@gmail.com>.
There's no way to do this in Curator currently that I'm aware of. You'd
have to implement a recursive function to query and delete child nodes
before deleting the parent node.


On Wed, Nov 13, 2013 at 6:35 PM, Techy Teck <co...@gmail.com> wrote:

> Is there any way to delete all the child nodes of any parent node
> recursively using curator?
>
>         CuratorFramework client =
> CuratorClient.createSimple("localhost:2181");
>         client.start();
>
>         client.delete().forPath("/foo");
>
>
> I have couple of children node inside /foo parent node. So is there any
> way to delete all the child nodes recursively within any parent node using
> Curator library?
>
> This is what I get -
>
> Exception in thread "main"
> org.apache.zookeeper.KeeperException$NotEmptyException: KeeperErrorCode =
> Directory not empty for /foo
>