You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by "Rakesh R (JIRA)" <ji...@apache.org> on 2013/09/23 13:28:06 UTC

[jira] [Commented] (ZOOKEEPER-1665) Support recursive deletion in multi

    [ https://issues.apache.org/jira/browse/ZOOKEEPER-1665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13774473#comment-13774473 ] 

Rakesh R commented on ZOOKEEPER-1665:
-------------------------------------

Hi [~ted_yu], From the HBASE-7847 description, I've seen the usecase of HBase is to delete recursively all the child znodes atomically. I could see the multi-transaction api behavior is not actually executing the operations in an atomic fashion.

If needed I would help in uploading a simple patch which uses multi-transaction api, but I feel, it would not actually serving the usecase mentioned in the HBASE-7847 jira.

I also had a similar usecase, where I need to atomically delete all the childnodes. When I observed the behavior, in server 'multi-op' is iterating and committing one by one operations orderly, if any of the operation fails, it would mark all the subsequent operations as 'Code.RUNTIMEINCONSISTENCY' and return without rollback the previously committed operations.

Following snippet in zk server code shows the behavior:
{code}
                    /* If we've already failed one of the ops, don't bother
                     * trying the rest as we know it's going to fail and it
                     * would be confusing in the logfiles.
                     */
                    if (ke != null) {
                        type = OpCode.error;
                        txn = new ErrorTxn(Code.RUNTIMEINCONSISTENCY.intValue());
                    }
{code}

For example, I've the following znodes created: 
/parent/child1
/parent/child2
/parent/child3
/parent/child4

Given '/parent' node for the recursive deletion of its child. Say zkclient#multi prepares Op#delete in the order child1, child2, child3, child4 and submits these to the server.
Now, assume after deleting child2, server fails to delete child3(one possible case is NoNodeException occurs - child3 doesn't exists, due to a race condition with some other delete operations). The multi call will immediately return with return codes : child1 - OK, child2 - OK, child3 - RUNTIMEINCONSISTENCY, child4 - RUNTIMEINCONSISTENCY. Here its not trying for the child4 node at all.

Please correct me if I'm missing anything.


                
> Support recursive deletion in multi
> -----------------------------------
>
>                 Key: ZOOKEEPER-1665
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1665
>             Project: ZooKeeper
>          Issue Type: New Feature
>            Reporter: Ted Yu
>
> Use case in HBase is that we need to recursively delete multiple subtrees:
> {code}
>     ZKUtil.deleteChildrenRecursively(watcher, acquiredZnode);
>     ZKUtil.deleteChildrenRecursively(watcher, reachedZnode);
>     ZKUtil.deleteChildrenRecursively(watcher, abortZnode);
> {code}
> To achieve high consistency, it is desirable to use multi for the above operations.
> This JIRA adds support for recursive deletion in multi.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira