public static boolean delQuota()

in kyuubi-relocated-zookeeper-parent/kyuubi-relocated-zookeeper-34/src/main/java/org/apache/zookeeper/ZooKeeperMain.java [410:444]


  public static boolean delQuota(ZooKeeper zk, String path, boolean bytes, boolean numNodes)
      throws KeeperException, IOException, InterruptedException {
    String parentPath = Quotas.quotaZookeeper + path;
    String quotaPath = Quotas.quotaZookeeper + path + "/" + Quotas.limitNode;
    if (zk.exists(quotaPath, false) == null) {
      System.out.println("Quota does not exist for " + path);
      return true;
    }
    byte[] data = null;
    try {
      data = zk.getData(quotaPath, false, new Stat());
    } catch (KeeperException.NoNodeException ne) {
      System.err.println("quota does not exist for " + path);
      return true;
    }
    StatsTrack strack = new StatsTrack(new String(data));
    if (bytes && !numNodes) {
      strack.setBytes(-1L);
      zk.setData(quotaPath, strack.toString().getBytes(), -1);
    } else if (!bytes && numNodes) {
      strack.setCount(-1);
      zk.setData(quotaPath, strack.toString().getBytes(), -1);
    } else if (bytes && numNodes) {
      // delete till you can find a node with more than
      // one child
      List<String> children = zk.getChildren(parentPath, false);
      /// delete the direct children first
      for (String child : children) {
        zk.delete(parentPath + "/" + child, -1);
      }
      // cut the tree till their is more than one child
      trimProcQuotas(zk, parentPath);
    }
    return true;
  }