@Test
  public void testBatchedDeletesOfWideZNodes() throws Exception {
    // Batch every 50bytes
    final int batchSize = 50;
    Configuration localConf = new Configuration(TEST_UTIL.getConfiguration());
    localConf.setInt("zookeeper.multi.max.size", batchSize);
    try (ZKWatcher customZkw =
      new ZKWatcher(localConf, "TestZKMulti_Custom", new ZKMultiAbortable(), true)) {

      // With a parent znode like this, we'll get batches of 2-3 elements
      final String parent1 = "/batchedDeletes1";
      final String parent2 = "/batchedDeletes2";
      final byte[] EMPTY_BYTES = new byte[0];

      // Write one node
      List<Op> ops = new ArrayList<>();
      ops.add(Op.create(parent1, EMPTY_BYTES, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT));
      for (int i = 0; i < batchSize * 2; i++) {
        ops.add(
          Op.create(parent1 + "/" + i, EMPTY_BYTES, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT));
      }
      customZkw.getRecoverableZooKeeper().multi(ops);

      // Write into a second node
      ops.clear();
      ops.add(Op.create(parent2, EMPTY_BYTES, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT));
      for (int i = 0; i < batchSize * 4; i++) {
        ops.add(
          Op.create(parent2 + "/" + i, EMPTY_BYTES, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT));
      }
      customZkw.getRecoverableZooKeeper().multi(ops);

      // These should return successfully
      ZKUtil.deleteChildrenRecursively(customZkw, parent1);
      ZKUtil.deleteChildrenRecursively(customZkw, parent2);
    }
  }
Verifies that for the given root node, it should delete all the nodes recursively using
multi-update api.
hbase-zookeeper/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZKMulti.java