/** * Deletes the specified node. Fails silent if the node does not exist. * * @param zkw reference to the {@link ZKWatcher} which also contains configuration and operation * @param node the node to delete * @throws KeeperException if a ZooKeeper operation fails */ public static void deleteNodeFailSilent(ZKWatcher zkw, String node) throws KeeperException { deleteNodeFailSilent(zkw, (DeleteNodeFailSilent)ZKUtilOp.deleteNodeFailSilent(node)); }
private static void processSequentially(ZKWatcher zkw, List<ZKUtilOp> ops) throws KeeperException, NoNodeException { for (ZKUtilOp op : ops) { if (op instanceof CreateAndFailSilent) { createAndFailSilent(zkw, (CreateAndFailSilent) op); } else if (op instanceof DeleteNodeFailSilent) { deleteNodeFailSilent(zkw, (DeleteNodeFailSilent) op); } else if (op instanceof SetData) { setData(zkw, (SetData) op); } else { throw new UnsupportedOperationException("Unexpected ZKUtilOp type: " + op.getClass().getName()); } } }
@Override public void removeReplicatorIfQueueIsEmpty(ServerName serverName) throws ReplicationException { try { ZKUtil.deleteNodeFailSilent(zookeeper, getRsNode(serverName)); } catch (NotEmptyException e) { // keep silence to avoid logging too much. } catch (KeeperException e) { throw new ReplicationException("Failed to remove replicator for " + serverName, e); } }
/** * Utility method that knows how to delete the old hbase-1.x table state znode. Used also by the * Mirroring subclass. * @deprecated Since 2.0.0. To be removed in hbase-3.0.0. */ @Deprecated protected void deleteZooKeeper(TableName tableName) { try { // Delete from ZooKeeper String znode = ZNodePaths.joinZNode(this.master.getZooKeeper().getZNodePaths().tableZNode, tableName.getNameAsString()); ZKUtil.deleteNodeFailSilent(this.master.getZooKeeper(), znode); } catch (KeeperException e) { LOG.warn("Failed deleting table state from zookeeper", e); } } }
/** * Removes the leader znode, if it is currently claimed by this instance. */ public void stepDownAsLeader() { try { synchronized(lock) { if (!leaderExists.get()) { return; } byte[] leaderId = ZKUtil.getData(watcher, leaderZNode); if (leaderId != null && Bytes.equals(nodeId, leaderId)) { LOG.info("Stepping down as leader"); ZKUtil.deleteNodeFailSilent(watcher, leaderZNode); leaderExists.set(false); } else { LOG.info("Not current leader, no need to step down"); } } } catch (KeeperException ke) { watcher.abort("Unhandled zookeeper exception removing leader node", ke); candidate.stop("Unhandled zookeeper exception removing leader node: " + ke.getMessage()); } catch (InterruptedException e) { watcher.abort("Unhandled zookeeper exception removing leader node", e); candidate.stop("Unhandled zookeeper exception removing leader node: " + e.getMessage()); } }
private void watchAndCheckExists(String node) { try { if (ZKUtil.watchAndCheckExists(watcher, node)) { byte[] data = ZKUtil.getDataAndWatch(watcher, node); if (data != null) { // put the data into queue upsertQueue(node, data); } else { // It existed but now does not, should has been tracked by our watcher, ignore LOG.debug("Found no data from " + node); watchAndCheckExists(node); } } else { // cleanup stale ZNodes on client ZK to avoid invalid requests to server ZKUtil.deleteNodeFailSilent(clientZkWatcher, node); } } catch (KeeperException e) { server.abort("Unexpected exception during initialization, aborting", e); } }
if (ZNodeClearer.tablesOnMaster(conf)) { ZKUtil.deleteNodeFailSilent(zkw, ZNodePaths.joinZNode(zkw.getZNodePaths().rsZNode, znodeFileContent)); return MasterAddressTracker.deleteIfEquals(zkw,
List<String> wals = ZKUtil.listChildrenNoWatch(zookeeper, oldQueueNode); if (CollectionUtils.isEmpty(wals)) { ZKUtil.deleteNodeFailSilent(zookeeper, oldQueueNode); LOG.info("Removed empty {}/{}", sourceServerName, queueId); return new Pair<>(newQueueId, Collections.emptySortedSet());
ZKUtil.deleteNodeFailSilent(this.watcher, backupZNode);
String node = ZNodePaths.joinZNode(parentZnode, server.getServerName()); try { ZKUtil.deleteNodeFailSilent(getZooKeeper(), node); } catch (KeeperException ke) { throw new HBaseIOException(
/** * Deletes the specified node. Fails silent if the node does not exist. * @param zkw * @param node * @throws KeeperException */ public static void deleteNodeFailSilent(ZooKeeperWatcher zkw, String node) throws KeeperException { deleteNodeFailSilent(zkw, (DeleteNodeFailSilent)ZKUtilOp.deleteNodeFailSilent(node)); }
/** * Deletes the specified node. Fails silent if the node does not exist. * * @param zkw reference to the {@link ZKWatcher} which also contains configuration and operation * @param node the node to delete * @throws KeeperException if a ZooKeeper operation fails */ public static void deleteNodeFailSilent(ZKWatcher zkw, String node) throws KeeperException { deleteNodeFailSilent(zkw, (DeleteNodeFailSilent)ZKUtilOp.deleteNodeFailSilent(node)); }
/** * Deletes the specified node. Fails silent if the node does not exist. * @param zkw * @param node * @throws KeeperException */ public static void deleteNodeFailSilent(ZooKeeperWatcher zkw, String node) throws KeeperException { deleteNodeFailSilent(zkw, (DeleteNodeFailSilent)ZKUtilOp.deleteNodeFailSilent(node)); }
private static void processSequentially(ZKWatcher zkw, List<ZKUtilOp> ops) throws KeeperException, NoNodeException { for (ZKUtilOp op : ops) { if (op instanceof CreateAndFailSilent) { createAndFailSilent(zkw, (CreateAndFailSilent) op); } else if (op instanceof DeleteNodeFailSilent) { deleteNodeFailSilent(zkw, (DeleteNodeFailSilent) op); } else if (op instanceof SetData) { setData(zkw, (SetData) op); } else { throw new UnsupportedOperationException("Unexpected ZKUtilOp type: " + op.getClass().getName()); } } }
private static void processSequentially(ZooKeeperWatcher zkw, List<ZKUtilOp> ops) throws KeeperException, NoNodeException { for (ZKUtilOp op : ops) { if (op instanceof CreateAndFailSilent) { createAndFailSilent(zkw, (CreateAndFailSilent) op); } else if (op instanceof DeleteNodeFailSilent) { deleteNodeFailSilent(zkw, (DeleteNodeFailSilent) op); } else if (op instanceof SetData) { setData(zkw, (SetData) op); } else { throw new UnsupportedOperationException("Unexpected ZKUtilOp type: " + op.getClass().getName()); } } }
private static void processSequentially(ZooKeeperWatcher zkw, List<ZKUtilOp> ops) throws KeeperException, NoNodeException { for (ZKUtilOp op : ops) { if (op instanceof CreateAndFailSilent) { createAndFailSilent(zkw, (CreateAndFailSilent) op); } else if (op instanceof DeleteNodeFailSilent) { deleteNodeFailSilent(zkw, (DeleteNodeFailSilent) op); } else if (op instanceof SetData) { setData(zkw, (SetData) op); } else { throw new UnsupportedOperationException("Unexpected ZKUtilOp type: " + op.getClass().getName()); } } }
@Override public void removeReplicatorIfQueueIsEmpty(ServerName serverName) throws ReplicationException { try { ZKUtil.deleteNodeFailSilent(zookeeper, getRsNode(serverName)); } catch (NotEmptyException e) { // keep silence to avoid logging too much. } catch (KeeperException e) { throw new ReplicationException("Failed to remove replicator for " + serverName, e); } }
/** * Delete the assignment node regardless of its current state. * <p> * Fail silent even if the node does not exist at all. * @param watcher * @param regionInfo * @throws KeeperException */ public static void deleteNodeFailSilent(ZooKeeperWatcher watcher, HRegionInfo regionInfo) throws KeeperException { String node = getNodeName(watcher, regionInfo.getEncodedName()); ZKUtil.deleteNodeFailSilent(watcher, node); }
/** * Delete the assignment node regardless of its current state. * <p> * Fail silent even if the node does not exist at all. * @param watcher * @param regionInfo * @throws KeeperException */ public static void deleteNodeFailSilent(ZooKeeperWatcher watcher, HRegionInfo regionInfo) throws KeeperException { String node = getNodeName(watcher, regionInfo.getEncodedName()); ZKUtil.deleteNodeFailSilent(watcher, node); }
/** * Deletes the table in zookeeper. Fails silently if the table is not currently disabled in * zookeeper. Sets no watches. {@inheritDoc} */ @Override public void setDeletedTable(final TableName tableName) throws CoordinatedStateException { synchronized (this.cache) { if (this.cache.remove(tableName) == null) { LOG.warn("Moving table " + tableName + " state to deleted but was already deleted"); } try { ZKUtil.deleteNodeFailSilent(this.watcher, ZKUtil.joinZNode(this.watcher.tableZNode, tableName.getNameAsString())); } catch (KeeperException e) { throw new CoordinatedStateException(e); } } }