enixon commented on a change in pull request #899: ZOOKEEPER-3354: Improve 
efficiency of DeleteAllCommand
URL: https://github.com/apache/zookeeper/pull/899#discussion_r284359820
 
 

 ##########
 File path: zookeeper-server/src/main/java/org/apache/zookeeper/ZKUtil.java
 ##########
 @@ -45,20 +48,71 @@
      *
      * @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.
 
 Review comment:
   1000 seemed like a reasonable number. I'm open to the idea of allowing the 
user to do their own custom tuning, we didn't go with it because the available 
schemes looked heavyweight and in practice, the users didn't care.
   
   Two options: (1) take this property as a java/system arg or (2) modify the 
cli for deleteall to allow batch size as a parameter in addition to the path. 
Do you want to speak for one of these?

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to