private static void verifyParentWithTopoChildrenDeleteDead(CuratorFramework zk, ACL superUserAcl, String path, Map<String, Id> topoToZkCreds, boolean fixUp, int perms) throws Exception { if (zk.checkExists().forPath(path) != null) { verifyAclStrict(zk, Arrays.asList(superUserAcl), path, fixUp); Set<String> possiblyBadIds = new HashSet<>(); for (String topoId : zk.getChildren().forPath(path)) { String childPath = path + ClusterUtils.ZK_SEPERATOR + topoId; if (!topoToZkCreds.containsKey(topoId)) { //Save it to try again later... possiblyBadIds.add(topoId); } else { List<ACL> rwAcl = getTopoAcl(path, topoId, topoToZkCreds, superUserAcl, fixUp, perms); verifyAclStrictRecursive(zk, rwAcl, childPath, fixUp); } } if (!possiblyBadIds.isEmpty()) { //Lets reread the children in STORMS as the source of truth and see if a new one was created in the background possiblyBadIds.removeAll(zk.getChildren().forPath(ClusterUtils.STORMS_SUBTREE)); for (String topoId : possiblyBadIds) { //Now we know for sure that this is a bad id String childPath = path + ClusterUtils.ZK_SEPERATOR + topoId; zk.delete().deletingChildrenIfNeeded().forPath(childPath); } } } }
public void delete(String path) { path = "/" + path; try { _curator.delete().forPath(path); } catch (KeeperException.NoNodeException nne) { LOG.warn("Path {} already deleted."); } catch (Exception e) { throw new RuntimeException(e); } LOG.debug("Deleted [path = {}]", path); }
public static void deleteNode(CuratorFramework zk, String path) { try { String npath = normalizePath(path); if (existsNode(zk, npath, false)) { zk.delete().deletingChildrenIfNeeded().forPath(normalizePath(path)); } } catch (Exception e) { if (Utils.exceptionCauseIsInstanceOf(KeeperException.NodeExistsException.class, e)) { // do nothing LOG.info("delete {} failed.", path, e); } else { throw Utils.wrapInRuntime(e); } } }
public void delete(String path) { path = "/" + path; try { _curator.delete().forPath(path); } catch (KeeperException.NoNodeException nne){ LOG.warn("Path {} already deleted."); } catch (Exception e) { throw new RuntimeException(e); } }
@Test public void testNimbodesWithLatestVersionOfBlob() throws Exception { try (TestingServer server = new TestingServer(); CuratorFramework zkClient = CuratorFrameworkFactory .newClient(server.getConnectString(), new ExponentialBackoffRetry(1000, 3))) { zkClient.start(); // Creating nimbus hosts containing latest version of blob zkClient.create().creatingParentContainersIfNeeded().forPath("/blobstore/key1/nimbus1:7800-1"); zkClient.create().creatingParentContainersIfNeeded().forPath("/blobstore/key1/nimbus2:7800-2"); Set<NimbusInfo> set = BlobStoreUtils.getNimbodesWithLatestSequenceNumberOfBlob(zkClient, "key1"); assertEquals("Failed to get the correct nimbus hosts with latest blob version", (set.iterator().next()).getHost(), "nimbus2"); zkClient.delete().deletingChildrenIfNeeded().forPath("/blobstore/key1/nimbus1:7800-1"); zkClient.delete().deletingChildrenIfNeeded().forPath("/blobstore/key1/nimbus2:7800-2"); } }
public void delete(String path) { path = "/" + path; try { _curator.delete().forPath(path); } catch (KeeperException.NoNodeException nne){ LOG.warn("Path {} already deleted."); } catch (Exception e) { throw new RuntimeException(e); } LOG.debug("Deleted [path = {}]", path); }
private static void verifyParentWithTopoChildrenDeleteDead(CuratorFramework zk, ACL superUserAcl, String path, Map<String, Id> topoToZkCreds, boolean fixUp, int perms) throws Exception { if (zk.checkExists().forPath(path) != null) { verifyAclStrict(zk, Arrays.asList(superUserAcl), path, fixUp); Set<String> possiblyBadIds = new HashSet<>(); for (String topoId : zk.getChildren().forPath(path)) { String childPath = path + ClusterUtils.ZK_SEPERATOR + topoId; if (!topoToZkCreds.containsKey(topoId)) { //Save it to try again later... possiblyBadIds.add(topoId); } else { List<ACL> rwAcl = getTopoAcl(path, topoId, topoToZkCreds, superUserAcl, fixUp, perms); verifyAclStrictRecursive(zk, rwAcl, childPath, fixUp); } } if (!possiblyBadIds.isEmpty()) { //Lets reread the children in STORMS as the source of truth and see if a new one was created in the background possiblyBadIds.removeAll(zk.getChildren().forPath(ClusterUtils.STORMS_SUBTREE)); for (String topoId: possiblyBadIds) { //Now we know for sure that this is a bad id String childPath = path + ClusterUtils.ZK_SEPERATOR + topoId; zk.delete().deletingChildrenIfNeeded().forPath(childPath); } } } }
public static void deleteNode(CuratorFramework zk, String path){ try { String npath = normalizePath(path); if (existsNode(zk, npath, false)) { zk.delete().deletingChildrenIfNeeded().forPath(normalizePath(path)); } } catch (Exception e) { if (Utils.exceptionCauseIsInstanceOf(KeeperException.NodeExistsException.class, e)) { // do nothing LOG.info("delete {} failed.", path, e); } else { throw Utils.wrapInRuntime(e); } } }