zookeeper-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [zookeeper] enixon commented on a change in pull request #899: ZOOKEEPER-3354: Improve efficiency of DeleteAllCommand
Date Fri, 03 May 2019 19:27:03 GMT
enixon commented on a change in pull request #899: ZOOKEEPER-3354: Improve efficiency of DeleteAllCommand
URL: https://github.com/apache/zookeeper/pull/899#discussion_r280900630
 
 

 ##########
 File path: zookeeper-server/src/main/java/org/apache/zookeeper/ZKUtil.java
 ##########
 @@ -45,20 +48,67 @@
      *
      * @throws IllegalArgumentException if an invalid path is specified
      */
-    public static void deleteRecursive(ZooKeeper zk, final String pathRoot)
+    public static boolean deleteRecursive(ZooKeeper zk, final String pathRoot)
         throws InterruptedException, KeeperException
     {
         PathUtils.validatePath(pathRoot);
 
         List<String> tree = listSubTreeBFS(zk, pathRoot);
         LOG.debug("Deleting " + tree);
         LOG.debug("Deleting " + tree.size() + " subnodes ");
-        for (int i = tree.size() - 1; i >= 0 ; --i) {
-            //Delete the leaves first and eventually get rid of the root
-            zk.delete(tree.get(i), -1); //Delete all versions of the node with -1.
+
+        int asyncReqRateLimit = 10;
+        // Try deleting the tree nodes in batches of size 1000.
+        // If some batch failed, try again with batches of size 1 to delete as
+        // many nodes as possible.
 
 Review comment:
   To help capture a plausible scenario, I've added a new unit test as you suggest.
   
   Using a multi-op batch mode is bound to be more brittle than using single operations. As
a user, I'd rather that the tool retry in the more resilient mode if the less resilient suffered
a failure rather than be asked to debug/retry manually.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message