org.apache.hadoop.hbase.zookeeper.ZKAssign.transitionNodeOpening()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(2.2k)|赞(0)|评价(0)|浏览(108)

本文整理了Java中org.apache.hadoop.hbase.zookeeper.ZKAssign.transitionNodeOpening()方法的一些代码示例,展示了ZKAssign.transitionNodeOpening()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZKAssign.transitionNodeOpening()方法的具体详情如下:
包路径:org.apache.hadoop.hbase.zookeeper.ZKAssign
类名称:ZKAssign
方法名:transitionNodeOpening

ZKAssign.transitionNodeOpening介绍

[英]Transitions an existing unassigned node for the specified region which is currently in the OFFLINE state to be in the OPENING state.

Does not transition nodes from other states. If for some reason the node could not be transitioned, the method returns -1. If the transition is successful, the version of the node written as OPENING is returned.

This method can fail and return -1 for three different reasons:

  • Unassigned node for this region does not exist
  • Unassigned node for this region is not in OFFLINE state
  • After verifying OFFLINE state, update fails because of wrong version (someone else already transitioned the node)

Does not set any watches.

This method should only be used by a RegionServer when initiating an open of a region after receiving an OPEN RPC from the Master.
[中]将当前处于脱机状态的指定区域的现有未分配节点转换为打开状态。
不从其他状态转换节点。如果由于某种原因无法转换节点,该方法将返回-1。如果转换成功,则返回写为打开的节点版本。
由于三种不同的原因,此方法可能会失败并返回-1:
*此区域的未分配节点不存在
*此区域的未分配节点未处于脱机状态
*验证脱机状态后,更新因版本错误而失败(其他人已转换该节点)
不设置任何手表。
只有RegionServer在从主服务器接收到打开的RPC后启动区域的打开时,才应使用此方法。

代码示例

代码示例来源:origin: co.cask.hbase/hbase

HRegionInfo region, ServerName serverName)
throws KeeperException {
 return transitionNodeOpening(zkw, region, serverName,
  EventType.M_ZK_REGION_OFFLINE);

代码示例来源:origin: harbby/presto-connectors

HRegionInfo region, ServerName serverName)
throws KeeperException {
 return transitionNodeOpening(zkw, region, serverName,
  EventType.M_ZK_REGION_OFFLINE);

代码示例来源:origin: NGDATA/lilyproject

/**
 * Creates a znode with OPENED state.
 */
public static ZooKeeperWatcher createAndForceNodeToOpenedState(
    HBaseTestingUtility TEST_UTIL, HRegion region,
    ServerName serverName) throws ZooKeeperConnectionException,
    IOException, KeeperException, NodeExistsException {
  ZooKeeperWatcher zkw = getZooKeeperWatcher(TEST_UTIL);
  ZKAssign.createNodeOffline(zkw, region.getRegionInfo(), serverName);
  int version = ZKAssign.transitionNodeOpening(zkw, region
      .getRegionInfo(), serverName);
  ZKAssign.transitionNodeOpened(zkw, region.getRegionInfo(), serverName,
      version);
  return zkw;
}

相关文章