[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=13958004#comment-13958004 ] Rakesh R commented on ZOOKEEPER-1665: - [~tedyu], Recently we have made good progress on HBASE-7847, as per our discussion its decided to do the necessary changes in HBase itself. Now do we really required this issue to be open in ZK ?. > 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 was sent by Atlassian JIRA (v6.2#6252)
[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=13931718#comment-13931718 ] Ted Yu commented on ZOOKEEPER-1665: --- The snippet looks good. Patch is welcome. Thanks > 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 was sent by Atlassian JIRA (v6.2#6252)
[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=13931552#comment-13931552 ] Rakesh R commented on ZOOKEEPER-1665: - Hi [~yuzhih...@gmail.com], My bad, previously when I tested multi api it failed. Now its working fine for me. I don't have a strong point to expose a new utility api for multiDeleteRecursive(). Because users can still achieve the behavior through the existing "ZKUtil" and "ZooKeeper" exposed apis. If anybody interested, I would be happy to convert the snippet into a patch. Please see the below snippet where it shows one pattern to achieve it, here you can pass String array {acquiredZnode, reachedZnode, abortZnode} or if you dont want the transaction across pathRoots, simply pass one by one. Hope this will help you. {code} public static List multiDeleteRecursive(ZooKeeper zk, String... pathRoots) throws InterruptedException, KeeperException { // TODO: handle empty pathRoots and return. List opList = new ArrayList(); for (String eachPath : pathRoots) { List eachRoot = prepareOpList(zk, eachPath); opList.addAll(eachRoot); } return zk.multi(opList); } private static List prepareOpList(ZooKeeper zk, final String pathRoot) throws InterruptedException, KeeperException { PathUtils.validatePath(pathRoot); List tree = ZKUtil.listSubTreeBFS(zk, pathRoot); LOG.debug("Deleting " + tree); LOG.debug("Deleting " + tree.size() + " subnodes "); List opList = new ArrayList(tree.size()); for (int i = tree.size() - 1; i >= 0; --i) { // Delete the leaves first and eventually get rid of the root opList.add(Op.delete(tree.get(i), -1)); } return opList; } {code} Thanks, Rakesh > 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 was sent by Atlassian JIRA (v6.2#6252)
[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=13825047#comment-13825047 ] Ted Yu commented on ZOOKEEPER-1665: --- bq. and return without rollback the previously committed operations. If this limitation cannot be lifted with reasonable effort, I can resolve this JIRA. > 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 was sent by Atlassian JIRA (v6.1#6144)
[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
[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=13614492#comment-13614492 ] Gregory Chanan commented on ZOOKEEPER-1665: --- I'm planning to have a go at this. Will post some thoughts later. > 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