- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中org.apache.hadoop.hbase.procedure.ZKProcedureUtil
类的一些代码示例,展示了ZKProcedureUtil
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZKProcedureUtil
类的具体详情如下:
包路径:org.apache.hadoop.hbase.procedure.ZKProcedureUtil
类名称:ZKProcedureUtil
[英]This is a shared ZooKeeper-based znode management utils for distributed procedure. All znode operations should go through the provided methods in coordinators and members. Layout of nodes in ZK is /hbase/[op name]/acquired/ [op instance] - op data/ /[nodes that have acquired] /reached/ [op instance]/ /[nodes that have completed] /abort/ [op instance] - failure data NOTE: while acquired and completed are znode dirs, abort is actually just a znode. Assumption here that procedure names are unique
[中]这是一个基于ZooKeeper的共享znode管理UTIL,用于分布式过程。所有znode操作都应该通过协调员和成员中提供的方法进行。ZK中的节点布局为/hbase/[op name]/acquired/[op instance]-op data//[nodes have acquired]/reach/[op instance]/[nodes have completed]/abort/[op instance]-failure data注意:虽然acquired和completed是znode dirs,但abort实际上只是znode。这里假设过程名称是唯一的
代码示例来源:origin: apache/hbase
/**
* Verify that the prepare, commit and abort nodes for the operation are removed from zookeeper
*/
private void verifyZooKeeperClean(String operationName, ZKWatcher watcher,
ZKProcedureUtil controller) throws Exception {
String prepare = ZKProcedureUtil.getAcquireBarrierNode(controller, operationName);
String commit = ZKProcedureUtil.getReachedBarrierNode(controller, operationName);
String abort = ZKProcedureUtil.getAbortNode(controller, operationName);
assertEquals("Didn't delete prepare node", -1, ZKUtil.checkExists(watcher, prepare));
assertEquals("Didn't delete commit node", -1, ZKUtil.checkExists(watcher, commit));
assertEquals("Didn't delete abort node", -1, ZKUtil.checkExists(watcher, abort));
}
代码示例来源:origin: apache/hbase
/**
* This should be called by the member and should write a serialized root cause exception as
* to the abort znode.
*/
@Override
public void sendMemberAborted(Subprocedure sub, ForeignException ee) {
if (sub == null) {
LOG.error("Failed due to null subprocedure", ee);
return;
}
String procName = sub.getName();
LOG.debug("Aborting procedure (" + procName + ") in zk");
String procAbortZNode = zkController.getAbortZNode(procName);
try {
String source = (ee.getSource() == null) ? memberName: ee.getSource();
byte[] errorInfo = ProtobufUtil.prependPBMagic(ForeignException.serialize(source, ee));
ZKUtil.createAndFailSilent(zkController.getWatcher(), procAbortZNode, errorInfo);
LOG.debug("Finished creating abort znode:" + procAbortZNode);
} catch (KeeperException e) {
// possible that we get this error for the procedure if we already reset the zk state, but in
// that case we should still get an error for that procedure anyways
zkController.logZKTree(zkController.getBaseZnode());
member.controllerConnectionFailure("Failed to post zk node:" + procAbortZNode
+ " to abort procedure", e, procName);
}
}
代码示例来源:origin: apache/hbase
zkProc.clearChildZNodes();
} catch (KeeperException e) {
LOG.error("Unable to start the ZK-based Procedure Coordinator rpcs.", e);
代码示例来源:origin: apache/hbase
public void clearZNodes(String procedureName) throws KeeperException {
LOG.info("Clearing all znodes for procedure " + procedureName + "including nodes "
+ acquiredZnode + " " + reachedZnode + " " + abortZnode);
// Make sure we trigger the watches on these nodes by creating them. (HBASE-13885)
String acquiredBarrierNode = getAcquiredBarrierNode(procedureName);
String reachedBarrierNode = getReachedBarrierNode(procedureName);
String abortZNode = getAbortZNode(procedureName);
ZKUtil.createAndFailSilent(watcher, acquiredBarrierNode);
ZKUtil.createAndFailSilent(watcher, abortZNode);
ZKUtil.deleteNodeRecursivelyMultiOrSequential(watcher, true, acquiredBarrierNode,
reachedBarrierNode, abortZNode);
if (LOG.isTraceEnabled()) {
logZKTree(this.baseZNode);
}
}
}
代码示例来源:origin: apache/hbase
private void watchForAbortedProcedures() {
LOG.debug("Checking for aborted procedures on node: '" + zkController.getAbortZnode() + "'");
try {
// this is the list of the currently aborted procedues
List<String> children = ZKUtil.listChildrenAndWatchForNewChildren(zkController.getWatcher(),
zkController.getAbortZnode());
if (children == null || children.isEmpty()) {
return;
}
for (String node : children) {
String abortNode = ZNodePaths.joinZNode(zkController.getAbortZnode(), node);
abort(abortNode);
}
} catch (KeeperException e) {
member.controllerConnectionFailure("Failed to list children for abort node:"
+ zkController.getAbortZnode(), e, null);
}
}
代码示例来源:origin: apache/hbase
private void waitForNewProcedures() {
// watch for new procedues that we need to start subprocedures for
LOG.debug("Looking for new procedures under znode:'" + zkController.getAcquiredBarrier() + "'");
List<String> runningProcedures = null;
try {
runningProcedures = ZKUtil.listChildrenAndWatchForNewChildren(zkController.getWatcher(),
zkController.getAcquiredBarrier());
if (runningProcedures == null) {
LOG.debug("No running procedures.");
return;
}
} catch (KeeperException e) {
member.controllerConnectionFailure("General failure when watching for new procedures",
e, null);
}
if (runningProcedures == null) {
LOG.debug("No running procedures.");
return;
}
for (String procName : runningProcedures) {
// then read in the procedure information
String path = ZNodePaths.joinZNode(zkController.getAcquiredBarrier(), procName);
startNewSubprocedure(path);
}
}
代码示例来源:origin: apache/hbase
/**
* This attempts to create an acquired state znode for the procedure (snapshot name).
*
* It then looks for the reached znode to trigger in-barrier execution. If not present we
* have a watcher, if present then trigger the in-barrier action.
*/
@Override
public void sendMemberAcquired(Subprocedure sub) throws IOException {
String procName = sub.getName();
try {
LOG.debug("Member: '" + memberName + "' joining acquired barrier for procedure (" + procName
+ ") in zk");
String acquiredZNode = ZNodePaths.joinZNode(ZKProcedureUtil.getAcquireBarrierNode(
zkController, procName), memberName);
ZKUtil.createAndFailSilent(zkController.getWatcher(), acquiredZNode);
// watch for the complete node for this snapshot
String reachedBarrier = zkController.getReachedBarrierNode(procName);
LOG.debug("Watch for global barrier reached:" + reachedBarrier);
if (ZKUtil.watchAndCheckExists(zkController.getWatcher(), reachedBarrier)) {
receivedReachedGlobalBarrier(reachedBarrier);
}
} catch (KeeperException e) {
member.controllerConnectionFailure("Failed to acquire barrier for procedure: "
+ procName + " and member: " + memberName, e, procName);
}
}
代码示例来源:origin: apache/hbase
@Override
public void sendGlobalBarrierReached(Procedure proc, List<String> nodeNames) throws IOException {
String procName = proc.getName();
String reachedNode = zkProc.getReachedBarrierNode(procName);
LOG.debug("Creating reached barrier zk node:" + reachedNode);
try {
ZKUtil.createWithParents(zkProc.getWatcher(), reachedNode);
if (ZKUtil.watchAndCheckExists(zkProc.getWatcher(), znode)) {
byte[] dataFromMember = ZKUtil.getData(zkProc.getWatcher(), znode);
代码示例来源:origin: apache/hbase
String prepare = ZKProcedureUtil.getAcquireBarrierNode(controller.getZkController(), operationName);
ZKUtil.createSetData(watcher, prepare, ProtobufUtil.prependPBMagic(data));
String commit = ZKProcedureUtil.getReachedBarrierNode(controller.getZkController(), operationName);
LOG.debug("Found prepared, posting commit node:" + commit);
ZKUtil.createAndFailSilent(watcher, commit);
ZKUtil.deleteNodeRecursively(watcher, controller.getZkController().getBaseZnode());
assertEquals("Didn't delete prepare node", -1, ZKUtil.checkExists(watcher, prepare));
assertEquals("Didn't delete commit node", -1, ZKUtil.checkExists(watcher, commit));
代码示例来源:origin: apache/hbase
/**
* This is the abort message being sent by the coordinator to member
*
* TODO this code isn't actually used but can be used to issue a cancellation from the
* coordinator.
*/
@Override
final public void sendAbortToMembers(Procedure proc, ForeignException ee) {
String procName = proc.getName();
LOG.debug("Aborting procedure '" + procName + "' in zk");
String procAbortNode = zkProc.getAbortZNode(procName);
try {
LOG.debug("Creating abort znode:" + procAbortNode);
String source = (ee.getSource() == null) ? coordName : ee.getSource();
byte[] errorInfo = ProtobufUtil.prependPBMagic(ForeignException.serialize(source, ee));
// first create the znode for the procedure
ZKUtil.createAndFailSilent(zkProc.getWatcher(), procAbortNode, errorInfo);
LOG.debug("Finished creating abort node:" + procAbortNode);
} catch (KeeperException e) {
// possible that we get this error for the procedure if we already reset the zk state, but in
// that case we should still get an error for that procedure anyways
zkProc.logZKTree(zkProc.baseZNode);
coordinator.rpcConnectionFailure("Failed to post zk node:" + procAbortNode
+ " to abort procedure '" + procName + "'", new IOException(e));
}
}
代码示例来源:origin: apache/hbase
String procName = proc.getName();
String abortNode = zkProc.getAbortZNode(procName);
try {
if (ZKUtil.watchAndCheckExists(zkProc.getWatcher(), abortNode)) {
abort(abortNode);
String acquire = zkProc.getAcquiredBarrierNode(procName);
LOG.debug("Creating acquire znode:" + acquire);
try {
ZKUtil.createWithParents(zkProc.getWatcher(), acquire, data);
if (ZKUtil.watchAndCheckExists(zkProc.getWatcher(), znode)) {
coordinator.memberAcquiredBarrier(procName, node);
代码示例来源:origin: co.cask.hbase/hbase
public void clearZNodes(String procedureName) throws KeeperException {
// TODO This is potentially racy since not atomic. update when we support zk that has multi
LOG.info("Clearing all znodes for procedure " + procedureName + "including nodes "
+ acquiredZnode + " " + reachedZnode + " " + abortZnode);
ZKUtil.deleteNodeRecursively(watcher, getAcquiredBarrierNode(procedureName));
ZKUtil.deleteNodeRecursively(watcher, getReachedBarrierNode(procedureName));
ZKUtil.deleteNodeRecursively(watcher, getAbortZNode(procedureName));
}
}
代码示例来源:origin: apache/hbase
String opName = ZKUtil.getNodeName(path);
String abortZNode = zkController.getAbortZNode(opName);
try {
if (ZKUtil.watchAndCheckExists(zkController.getWatcher(), abortZNode)) {
LOG.debug("Not starting:" + opName + " because we already have an abort notification.");
return;
byte[] data = ZKUtil.getData(zkController.getWatcher(), path);
if (!ProtobufUtil.isPBMagicPrefix(data)) {
String msg = "Data in for starting procedure " + opName +
代码示例来源:origin: apache/hbase
@Override
final public void close() throws IOException {
zkProc.close();
}
代码示例来源:origin: apache/hbase
public String getReachedBarrierNode(String opInstanceName) {
return ZKProcedureUtil.getReachedBarrierNode(this, opInstanceName);
}
代码示例来源:origin: apache/hbase
public String getAbortZNode(String opInstanceName) {
return ZKProcedureUtil.getAbortNode(this, opInstanceName);
}
代码示例来源:origin: apache/hbase
public String getAcquiredBarrierNode(String opInstanceName) {
return ZKProcedureUtil.getAcquireBarrierNode(this, opInstanceName);
}
代码示例来源:origin: co.cask.hbase/hbase
zkProc.clearChildZNodes();
} catch (KeeperException e) {
LOG.error("Unable to start the ZK-based Procedure Coordinator rpcs.", e);
LOG.debug("Starting the controller for procedure member:" + zkProc.getMemberName());
return true;
代码示例来源:origin: apache/hbase
/**
* Delete znodes that are no longer in use.
*/
@Override
final public void resetMembers(Procedure proc) throws IOException {
String procName = proc.getName();
boolean stillGettingNotifications = false;
do {
try {
LOG.debug("Attempting to clean out zk node for op:" + procName);
zkProc.clearZNodes(procName);
stillGettingNotifications = false;
} catch (KeeperException.NotEmptyException e) {
// recursive delete isn't transactional (yet) so we need to deal with cases where we get
// children trickling in
stillGettingNotifications = true;
} catch (KeeperException e) {
String msg = "Failed to complete reset procedure " + procName;
LOG.error(msg, e);
throw new IOException(msg, e);
}
} while (stillGettingNotifications);
}
代码示例来源:origin: co.cask.hbase/hbase
/**
* This attempts to create an acquired state znode for the procedure (snapshot name).
*
* It then looks for the reached znode to trigger in-barrier execution. If not present we
* have a watcher, if present then trigger the in-barrier action.
*/
@Override
public void sendMemberAcquired(Subprocedure sub) throws IOException {
String procName = sub.getName();
try {
LOG.debug("Member: '" + memberName + "' joining acquired barrier for procedure (" + procName
+ ") in zk");
String acquiredZNode = ZKUtil.joinZNode(ZKProcedureUtil.getAcquireBarrierNode(
zkController, procName), memberName);
ZKUtil.createAndFailSilent(zkController.getWatcher(), acquiredZNode);
// watch for the complete node for this snapshot
String reachedBarrier = zkController.getReachedBarrierNode(procName);
LOG.debug("Watch for global barrier reached:" + reachedBarrier);
if (ZKUtil.watchAndCheckExists(zkController.getWatcher(), reachedBarrier)) {
receivedReachedGlobalBarrier(reachedBarrier);
}
} catch (KeeperException e) {
member.controllerConnectionFailure("Failed to acquire barrier for procedure: "
+ procName + " and member: " + memberName, new IOException(e));
}
}
我有 3 个表: 1. 学生:{id, name, roll} 2. 主题:{id, name} 3. 分数:{student_id, subject_id, marks} 我有一个返回所有学生及其分
我将制作一款完全由程序生成的空间/交易/战斗游戏。但是,我知道将整个星系的所有细节存储在内存中是不可行的。因此,我一直认为我可以使用种子来生成太阳系,并且从该太阳系,您可以使用跳跃门前往其他太阳系。问
我有一个关于 ADS 中存储过程的性能的问题。我创建了一个具有以下结构的简单数据库: CREATE TABLE MainTable ( Id INTEGER PRIMARY KEY,
我想将这个简单的东西加载到我的编辑器中: Write:-repeat,write("hi"),nl,fail. 所以它打印“嗨”。 我该怎么办? 我目前正在尝试做 File->New 并将名为 Wri
在从 c# 调用过程中显示以下错误 "Procedure or function 'CALL get_Users()'cannot be foundin database 'joomla'."` 代码
在网上找到了创建存储过程的教程,只是不明白到底什么时候需要执行创建存储过程。 是否应该在每次重新启动 MySQL 服务器时执行存储过程创建? 我是否需要在每次启动我的应用程序时都执行存储过程创建sql
我有一个包含所有例程的 MySQL 转储。当我恢复时,只有存储过程没有恢复。我从中提取 Dump 的 MySQL 版本是 5.0.77-log,我恢复到的版本是 5.6.12。 感谢任何帮助。 谢谢
我是一家大量使用存储过程(500+)的公司的新手。为了帮助学习系统,我希望有一种简单的方法来构建一个树型列表,显示系统中的所有存储过程以及它们自己调用哪些存储过程......从而创建可以执行的存储过程
我需要使用 mysqldump 和 replace 而不是 insert 并且在恢复时不删除数据库和表。但我需要删除并重新创建触发器和存储过程 为此,我将 mysqldump 与 --replace
在执行代码的过程中,我在不同的Scheme实现中遇到以下错误: Racket : application: not a procedure; expected a procedure that ca
我想将存储过程输出参数映射到一个实体。 例如, PROCEDURE ForExample @ID int, @LastUpdate datetime OUTPUT AS Update EntityTa
假设我有“myStoredProcedure”,它接受一个 Id 作为参数,并返回一个信息表。 是否可以编写类似于此的 SQL 语句? SELECT MyColumn FROM Tabl
我想将整个 sql 查询作为词法参数传递给存储过程,然后执行它。任何建议如何做到这一点? 最佳答案 你可以试试这个: create or replace procedure my_proc(pstri
考虑以下测试用例: { CompilerVersion = 21 } procedure Global(); procedure Local(); begin end; type TP
在 Azure Cosmos Db 中,是否可以从另一个存储过程调用一个存储过程?那么UDF呢?我可以从另一个 UDF、存储过程或触发器调用一个 UDF吗? 最佳答案 is there a way t
在 Azure Cosmos Db 中,是否可以从另一个存储过程调用一个存储过程?那么UDF呢?我可以从另一个 UDF、存储过程或触发器调用一个 UDF吗? 最佳答案 is there a way t
在 LINQ to Entities 中,我将存储过程的结果集映射到实体。 在存储过程中,我执行一些更新语句并通过运行 SELECT 查询并将结果集映射到实体来返回结果集。 数据库行得到正确更新,但返
创建存储过程时,BEGIN/END 块是否有用途? 例如, CREATE PROCEDURE SPNAME AS SELECT * FROM TABLE 对比 CREATE PROCEDURE S
正如您在下面看到的,我的过程有两个参数。我希望它们都是整数。但是,当我使用非整数测试该过程时,它仍然可以编译!为什么? create procedure int_arith( p_1 int, p_
我有一个 Client类(class)。在那个类里面有一个数组 losses .首先,我创建并使用客户端填充 clientsColl大批。然后对于该数组中的每个客户端,我填充其 losses大批。 然
我是一名优秀的程序员,十分优秀!