public void removeTaskRunZnode(String taskId) throws Exception { try { curatorFramework.delete().guaranteed().forPath(getTaskPathForId(taskId)); } catch (KeeperException e) { log.debug( e, "Could not delete task path for task[%s]. This is not an error if httpRemote taskRunner is being used at overlord.", taskId ); } }
@Override public void close() throws IOException { State currentState = state.getAndSet(State.CLOSED); if (currentState == State.CLOSED || currentState == State.LATENT) return; client.getConnectionStateListenable().removeListener(connectionStateListener); String localNodePath = nodePath.getAndSet(null); if (localNodePath == null) return; try { client.delete().guaranteed().forPath(localNodePath); } catch (KeeperException.NoNodeException ignore) { } catch (Exception e) { LOG.error("Deleting node: " + localNodePath, e); throw new IOException(e); } }
@Override public void purgeLocks(String lockPathRoot) { lockPathRoot = norm(lockPathRoot); try { curator.delete().guaranteed().deletingChildrenIfNeeded().forPath(lockPathRoot); logger.info("{} purged all locks under {}", client, lockPathRoot); } catch (Exception ex) { throw new IllegalStateException("Error while " + client + " trying to purge " + lockPathRoot, ex); } }
protected void unannounceSegmentFromBatchForServer(DruidServer druidServer, DataSegment segment, String batchPath, ZkPathsConfig zkPathsConfig) throws Exception { curator.delete().guaranteed().forPath(batchPath); }
@Override public void unlock(String lockPath) { lockPath = norm(lockPath); logger.debug("{} trying to unlock {}", client, lockPath); String owner = peekLock(lockPath); if (owner == null) throw new IllegalStateException(client + " cannot unlock path " + lockPath + " which is not locked currently"); if (client.equals(owner) == false) throw new IllegalStateException(client + " cannot unlock path " + lockPath + " which is locked by " + owner); try { curator.delete().guaranteed().deletingChildrenIfNeeded().forPath(lockPath); logger.info("{} released lock at {}", client, lockPath); } catch (Exception ex) { throw new IllegalStateException("Error while " + client + " trying to unlock " + lockPath, ex); } }
String taskStatusPath = JOINER.join(workerStatusPath, taskId); try { cf.delete().guaranteed().forPath(taskStatusPath);
public void deleteRecursive(CuratorFramework zk, String path) throws Exception { String normPath = PathUtils.normalize_path(path); if (existsNode(zk, normPath, false)) { zk.delete().guaranteed().deletingChildrenIfNeeded().forPath(normPath); } }
@Override protected void removeStoredMasterKey(DelegationKey key) { String nodeRemovePath = getNodePath(ZK_DTSM_MASTER_KEY_ROOT, DELEGATION_KEY_PREFIX + key.getKeyId()); if (LOG.isDebugEnabled()) { LOG.debug("Removing ZKDTSMDelegationKey_" + key.getKeyId()); } try { if (zkClient.checkExists().forPath(nodeRemovePath) != null) { while(zkClient.checkExists().forPath(nodeRemovePath) != null){ try { zkClient.delete().guaranteed().forPath(nodeRemovePath); } catch (NoNodeException nne) { // It is possible that the node might be deleted between the // check and the actual delete.. which might lead to an // exception that can bring down the daemon running this // SecretManager LOG.debug("Node already deleted by peer " + nodeRemovePath); } } } else { LOG.debug("Attempted to delete a non-existing znode " + nodeRemovePath); } } catch (Exception e) { LOG.debug(nodeRemovePath + " znode could not be removed!!"); } }
while(zkClient.checkExists().forPath(nodeRemovePath) != null){ try { zkClient.delete().guaranteed().forPath(nodeRemovePath); } catch (NoNodeException nne) {
LOG.warn("Will attempt to remove the znode: " + fullZnodePath + " from ZooKeeper"); System.out.println("Will attempt to remove the znode: " + fullZnodePath + " from ZooKeeper"); zooKeeperClient.delete().guaranteed().inBackground(new DeleteCallBack()) .forPath(fullZnodePath);
final String statusPath = JOINER.join(indexerZkConfig.getStatusPath(), workerId, taskId); try { cf.delete().guaranteed().forPath(statusPath);
private void unannounceSegmentForServer(DruidServer druidServer, DataSegment segment) throws Exception { curator .delete() .guaranteed() .forPath(ZKPaths.makePath(inventoryPath, druidServer.getHost(), segment.getId().toString())); }
protected void unannounceSegmentForServer(DruidServer druidServer, DataSegment segment, ZkPathsConfig zkPathsConfig) throws Exception { String path = ZKPaths.makePath( zkPathsConfig.getLiveSegmentsPath(), druidServer.getHost(), segment.getId().toString() ); curator.delete().guaranteed().forPath(path); }
curator.delete().guaranteed().forPath(event.getData().getPath()); curator.delete().guaranteed().forPath(event.getData().getPath());
curator.delete().guaranteed().forPath(path);
curator.delete().guaranteed().forPath(ZKPaths.makePath(LOADPATH, dataSegment.getId().toString()));
curator.delete().guaranteed().forPath(dropRequestPath); Assert.assertTrue(timing.forWaiting().awaitLatch(segmentDroppedSignal[segmentSignalIdx.get()])); curator.delete().guaranteed().forPath(loadRequestPath); Assert.assertTrue(timing.forWaiting().awaitLatch(segmentLoadedSignal[segmentSignalIdx.get()]));
curator.delete().guaranteed().forPath(ZKPaths.makePath(DESTINATION_LOAD_PATH, segmentToMove.getId().toString())); curator.delete().guaranteed().forPath(ZKPaths.makePath(SOURCE_LOAD_PATH, segmentToMove.getId().toString()));
@Override protected void executeGuaranteedOperationInBackground(String path) throws Exception { client.delete().guaranteed().inBackground().forPath(path); } }
private void releaseLock() { try { if (zkClient.getState().equals(CuratorFrameworkState.STARTED)) { // client.setData().forPath(ZOOKEEPER_LOCK_PATH, null); if (zkClient.checkExists().forPath(schedulerId()) != null) { zkClient.delete().guaranteed().deletingChildrenIfNeeded().forPath(schedulerId()); } } } catch (Exception e) { logger.error("error release lock:" + schedulerId()); throw new RuntimeException(e); } }