gpt4 book ai didi

com.alibaba.wasp.zookeeper.ZKAssign.transitionNodeOpened()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-13 11:21:53 26 4
gpt4 key购买 nike

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

ZKAssign.transitionNodeOpened介绍

[英]Transitions an existing unassigned node for the specified entityGroup which is currently in the OPENING state to be in the OPENED 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 after transition is returned.

This method can fail and return false for three different reasons:

  • Unassigned node for this entityGroup does not exist
  • Unassigned node for this entityGroup is not in OPENING state
  • After verifying OPENING state, update fails because of wrong version (this should never actually happen since an RS only does this transition following a transition to OPENING. if two RS are conflicting, one would fail the original transition to OPENING and not this transition)

Does not set any watches.

This method should only be used by a FServer when completing the open of a entityGroup.
[中]将当前处于打开状态的指定entityGroup的现有未分配节点转换为处于打开状态。
不从其他状态转换节点。如果由于某种原因无法转换节点,该方法将返回-1。如果转换成功,则返回转换后的节点版本。
由于三种不同的原因,此方法可能会失败并返回false:
*此entityGroup的未分配节点不存在
*此entityGroup的未分配节点未处于打开状态
*验证打开状态后,由于版本错误,更新失败(这实际上不应该发生,因为RS只会在转换到打开后进行此转换。如果两个RS冲突,则其中一个会失败到打开的原始转换,而不是此转换)
不设置任何手表。
只有在完成entityGroup的打开时,FServer才应使用此方法。

代码示例

代码示例来源:origin: alibaba/wasp

if (ZKAssign.transitionNodeOpened(this.server.getZooKeeper(), egi,
  this.server.getServerName(), this.version) == -1) {
 LOG.warn("Completed the OPEN of entityGroup "

代码示例来源:origin: alibaba/wasp

/**
 * Creates a znode with OPENED state.
 *
 * @param TEST_UTIL
 * @param entityGroup
 * @param serverName
 * @return
 * @throws java.io.IOException
 * @throws ZooKeeperConnectionException
 * @throws org.apache.zookeeper.KeeperException
 * @throws org.apache.zookeeper.KeeperException.NodeExistsException
 */
public static ZooKeeperWatcher createAndForceNodeToOpenedState(
  WaspTestingUtility TEST_UTIL, EntityGroup entityGroup,
  ServerName serverName) throws ZooKeeperConnectionException, IOException,
  KeeperException, NodeExistsException {
 ZooKeeperWatcher zkw = getZooKeeperWatcher(TEST_UTIL);
 ZKAssign.createNodeOffline(zkw, entityGroup.getEntityGroupInfo(),
   serverName);
 int version = ZKAssign.transitionNodeOpening(zkw,
   entityGroup.getEntityGroupInfo(), serverName);
 ZKAssign.transitionNodeOpened(zkw, entityGroup.getEntityGroupInfo(),
   serverName, version);
 return zkw;
}

代码示例来源:origin: alibaba/wasp

/**
 * Fakes the regionserver-side zk transitions of a region open.
 * @param w ZooKeeperWatcher to use.
 * @param sn Name of the regionserver doing the 'opening'
 * @param egInfo EntityGroup we're 'opening'.
 * @throws org.apache.zookeeper.KeeperException
 * @throws com.alibaba.wasp.DeserializationException
 */
static void fakeEntityGroupServerEntityGroupOpenInZK(FMaster master,  final ZooKeeperWatcher w,
  final ServerName sn, final EntityGroupInfo egInfo)
 throws KeeperException, DeserializationException, InterruptedException {
 // Wait till the we region is ready to be open in RIT.
 waitForEntityGroupPendingOpenInRIT(master.getAssignmentManager(), egInfo.getEncodedName());
 // Get current versionid else will fail on transition from OFFLINE to OPENING below
 int versionid = ZKAssign.getVersion(w, egInfo);
 assertNotSame(-1, versionid);
 // This uglyness below is what the openregionhandler on FSERVER side does.  I
 // looked at exposing the method over in openregionhandler but its just a
 // one liner and its deep over in another package so just repeat it below.
 versionid = ZKAssign.transitionNode(w, egInfo, sn,
   EventType.M_ZK_ENTITYGROUP_OFFLINE, EventType.FSERVER_ZK_ENTITYGROUP_OPENING, versionid);
 assertNotSame(-1, versionid);
 // Move znode from OPENING to OPENED as FSERVER does on successful open.
 versionid = ZKAssign.transitionNodeOpened(w, egInfo, sn, versionid);
 assertNotSame(-1, versionid);
 // We should be done now.  The master open handler will notice the
 // transition and remove this regions znode.
}

代码示例来源:origin: alibaba/wasp

assertNotSame(-1, versionid);
versionid = ZKAssign.transitionNodeOpened(this.watcher, ENTITYGROUPINFO,
  SERVERNAME_B, versionid);
assertNotSame(-1, versionid);

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com