本文整理了Java中org.apache.hadoop.hbase.zookeeper.ZKUtil.deleteNodeFailSilent()
方法的一些代码示例,展示了ZKUtil.deleteNodeFailSilent()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZKUtil.deleteNodeFailSilent()
方法的具体详情如下:
包路径:org.apache.hadoop.hbase.zookeeper.ZKUtil
类名称:ZKUtil
方法名:deleteNodeFailSilent
[英]Deletes the specified node. Fails silent if the node does not exist.
[中]删除指定的节点。如果节点不存在,则失败为静默。
代码示例来源:origin: apache/hbase
/**
* 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));
}
代码示例来源:origin: apache/hbase
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());
}
}
}
代码示例来源:origin: apache/hbase
@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);
}
}
代码示例来源:origin: apache/hbase
/**
* 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);
}
}
}
代码示例来源:origin: apache/hbase
/**
* 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());
}
}
代码示例来源:origin: apache/hbase
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);
}
}
代码示例来源:origin: apache/hbase
if (ZNodeClearer.tablesOnMaster(conf)) {
ZKUtil.deleteNodeFailSilent(zkw,
ZNodePaths.joinZNode(zkw.getZNodePaths().rsZNode, znodeFileContent));
return MasterAddressTracker.deleteIfEquals(zkw,
代码示例来源:origin: apache/hbase
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());
代码示例来源:origin: apache/hbase
ZKUtil.deleteNodeFailSilent(this.watcher, backupZNode);
代码示例来源:origin: apache/hbase
String node = ZNodePaths.joinZNode(parentZnode, server.getServerName());
try {
ZKUtil.deleteNodeFailSilent(getZooKeeper(), node);
} catch (KeeperException ke) {
throw new HBaseIOException(
代码示例来源:origin: harbby/presto-connectors
/**
* 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));
}
代码示例来源:origin: org.apache.hbase/hbase-zookeeper
/**
* 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));
}
代码示例来源:origin: co.cask.hbase/hbase
/**
* 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));
}
代码示例来源:origin: org.apache.hbase/hbase-zookeeper
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());
}
}
}
代码示例来源:origin: harbby/presto-connectors
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());
}
}
}
代码示例来源:origin: co.cask.hbase/hbase
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());
}
}
}
代码示例来源:origin: org.apache.hbase/hbase-replication
@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);
}
}
代码示例来源:origin: co.cask.hbase/hbase
/**
* 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);
}
代码示例来源:origin: harbby/presto-connectors
/**
* 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);
}
代码示例来源:origin: harbby/presto-connectors
/**
* 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);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!