/** * Delete all the children of the specified node but not the node itself. * * Sets no watches. Throws all exceptions besides dealing with deletion of * children. * * @throws KeeperException if a ZooKeeper operation fails */ public static void deleteChildrenRecursively(ZKWatcher zkw, String node) throws KeeperException { deleteChildrenRecursivelyMultiOrSequential(zkw, true, node); }
public void clearChildZNodes() throws KeeperException { LOG.debug("Clearing all znodes {}, {}, {}", acquiredZnode, reachedZnode, abortZnode); // If the coordinator was shutdown mid-procedure, then we are going to lose // an procedure that was previously started by cleaning out all the previous state. Its much // harder to figure out how to keep an procedure going and the subject of HBASE-5487. ZKUtil.deleteChildrenRecursivelyMultiOrSequential(watcher, true, acquiredZnode, reachedZnode, abortZnode); if (LOG.isTraceEnabled()) { logZKTree(this.baseZNode); } }
/** * Verifies that for the given root node, it should delete all the child nodes * recursively using multi-update api. */ @Test public void testdeleteChildrenRecursivelyMulti() throws Exception { String parentZNode = "/testRootMulti"; createZNodeTree(parentZNode); ZKUtil.deleteChildrenRecursivelyMultiOrSequential(zkw, true, parentZNode); assertTrue("Wrongly deleted parent znode!", ZKUtil.checkExists(zkw, parentZNode) > -1); List<String> children = zkw.getRecoverableZooKeeper().getChildren( parentZNode, false); assertTrue("Failed to delete child znodes!", 0 == children.size()); }
@Test public void testDeleteChildrenRecursivelyMultiOrSequential() throws Exception { String parentZNode1 = "/testdeleteChildren1"; String parentZNode2 = "/testdeleteChildren2"; String parentZNode3 = "/testdeleteChildren3"; createZNodeTree(parentZNode1); createZNodeTree(parentZNode2); createZNodeTree(parentZNode3); ZKUtil.deleteChildrenRecursivelyMultiOrSequential(zkw, true, parentZNode1, parentZNode2, parentZNode3); assertTrue("Wrongly deleted parent znode 1!", ZKUtil.checkExists(zkw, parentZNode1) > -1); List<String> children = zkw.getRecoverableZooKeeper().getChildren(parentZNode1, false); assertTrue("Failed to delete child znodes of parent znode 1!", 0 == children.size()); assertTrue("Wrongly deleted parent znode 2!", ZKUtil.checkExists(zkw, parentZNode2) > -1); children = zkw.getRecoverableZooKeeper().getChildren(parentZNode2, false); assertTrue("Failed to delete child znodes of parent znode 1!", 0 == children.size()); assertTrue("Wrongly deleted parent znode 3!", ZKUtil.checkExists(zkw, parentZNode3) > -1); children = zkw.getRecoverableZooKeeper().getChildren(parentZNode3, false); assertTrue("Failed to delete child znodes of parent znode 1!", 0 == children.size()); }
/** * Delete all the children of the specified node but not the node itself. * * Sets no watches. Throws all exceptions besides dealing with deletion of * children. * * @throws KeeperException if a ZooKeeper operation fails */ public static void deleteChildrenRecursively(ZKWatcher zkw, String node) throws KeeperException { deleteChildrenRecursivelyMultiOrSequential(zkw, true, node); }
/** * Delete all the children of the specified node but not the node itself. * * Sets no watches. Throws all exceptions besides dealing with deletion of * children. * * If hbase.zookeeper.useMulti is true, use ZooKeeper's multi-update functionality. * Otherwise, run the list of operations sequentially. * * @throws KeeperException */ public static void deleteChildrenRecursively(ZooKeeperWatcher zkw, String node) throws KeeperException { deleteChildrenRecursivelyMultiOrSequential(zkw, true, node); }
public void clearChildZNodes() throws KeeperException { LOG.info("Clearing all procedure znodes: " + acquiredZnode + " " + reachedZnode + " " + abortZnode); // If the coordinator was shutdown mid-procedure, then we are going to lose // an procedure that was previously started by cleaning out all the previous state. Its much // harder to figure out how to keep an procedure going and the subject of HBASE-5487. ZKUtil.deleteChildrenRecursivelyMultiOrSequential(watcher, true, acquiredZnode, reachedZnode, abortZnode); if (LOG.isTraceEnabled()) { logZKTree(this.baseZNode); } }
/** * Verifies that for the given root node, it should delete all the child nodes * recursively using multi-update api. */ @Test public void testdeleteChildrenRecursivelyMulti() throws Exception { String parentZNode = "/testRootMulti"; createZNodeTree(parentZNode); ZKUtil.deleteChildrenRecursivelyMultiOrSequential(zkw, true, parentZNode); assertTrue("Wrongly deleted parent znode!", ZKUtil.checkExists(zkw, parentZNode) > -1); List<String> children = zkw.getRecoverableZooKeeper().getChildren( parentZNode, false); assertTrue("Failed to delete child znodes!", 0 == children.size()); }
/** * Verifies that for the given root node, it should delete all the child nodes * recursively using multi-update api. */ @Test public void testdeleteChildrenRecursivelyMulti() throws Exception { String parentZNode = "/testRootMulti"; createZNodeTree(parentZNode); ZKUtil.deleteChildrenRecursivelyMultiOrSequential(zkw, true, parentZNode); assertTrue("Wrongly deleted parent znode!", ZKUtil.checkExists(zkw, parentZNode) > -1); List<String> children = zkw.getRecoverableZooKeeper().getChildren( parentZNode, false); assertTrue("Failed to delete child znodes!", 0 == children.size()); }
@Test public void testDeleteChildrenRecursivelyMultiOrSequential() throws Exception { String parentZNode1 = "/testdeleteChildren1"; String parentZNode2 = "/testdeleteChildren2"; String parentZNode3 = "/testdeleteChildren3"; createZNodeTree(parentZNode1); createZNodeTree(parentZNode2); createZNodeTree(parentZNode3); ZKUtil.deleteChildrenRecursivelyMultiOrSequential(zkw, true, parentZNode1, parentZNode2, parentZNode3); assertTrue("Wrongly deleted parent znode 1!", ZKUtil.checkExists(zkw, parentZNode1) > -1); List<String> children = zkw.getRecoverableZooKeeper().getChildren(parentZNode1, false); assertTrue("Failed to delete child znodes of parent znode 1!", 0 == children.size()); assertTrue("Wrongly deleted parent znode 2!", ZKUtil.checkExists(zkw, parentZNode2) > -1); children = zkw.getRecoverableZooKeeper().getChildren(parentZNode2, false); assertTrue("Failed to delete child znodes of parent znode 1!", 0 == children.size()); assertTrue("Wrongly deleted parent znode 3!", ZKUtil.checkExists(zkw, parentZNode3) > -1); children = zkw.getRecoverableZooKeeper().getChildren(parentZNode3, false); assertTrue("Failed to delete child znodes of parent znode 1!", 0 == children.size()); }
@Test public void testDeleteChildrenRecursivelyMultiOrSequential() throws Exception { String parentZNode1 = "/testdeleteChildren1"; String parentZNode2 = "/testdeleteChildren2"; String parentZNode3 = "/testdeleteChildren3"; createZNodeTree(parentZNode1); createZNodeTree(parentZNode2); createZNodeTree(parentZNode3); ZKUtil.deleteChildrenRecursivelyMultiOrSequential(zkw, true, parentZNode1, parentZNode2, parentZNode3); assertTrue("Wrongly deleted parent znode 1!", ZKUtil.checkExists(zkw, parentZNode1) > -1); List<String> children = zkw.getRecoverableZooKeeper().getChildren(parentZNode1, false); assertTrue("Failed to delete child znodes of parent znode 1!", 0 == children.size()); assertTrue("Wrongly deleted parent znode 2!", ZKUtil.checkExists(zkw, parentZNode2) > -1); children = zkw.getRecoverableZooKeeper().getChildren(parentZNode2, false); assertTrue("Failed to delete child znodes of parent znode 1!", 0 == children.size()); assertTrue("Wrongly deleted parent znode 3!", ZKUtil.checkExists(zkw, parentZNode3) > -1); children = zkw.getRecoverableZooKeeper().getChildren(parentZNode3, false); assertTrue("Failed to delete child znodes of parent znode 1!", 0 == children.size()); }