当前位置: 首页>>代码示例>>Java>>正文


Java EventType.RS_ZK_REGION_SPLITTING属性代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.executor.EventHandler.EventType.RS_ZK_REGION_SPLITTING属性的典型用法代码示例。如果您正苦于以下问题:Java EventType.RS_ZK_REGION_SPLITTING属性的具体用法?Java EventType.RS_ZK_REGION_SPLITTING怎么用?Java EventType.RS_ZK_REGION_SPLITTING使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.hadoop.hbase.executor.EventHandler.EventType的用法示例。


在下文中一共展示了EventType.RS_ZK_REGION_SPLITTING属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: nodeChildrenChanged

/**
 * New unassigned node has been created.
 *
 * <p>This happens when an RS begins the OPENING, SPLITTING or CLOSING of a
 * region by creating a znode.
 *
 * <p>When this happens we must:
 * <ol>
 *   <li>Watch the node for further children changed events</li>
 *   <li>Watch all new children for changed events</li>
 * </ol>
 */
@Override
public void nodeChildrenChanged(String path) {
  if(path.equals(watcher.assignmentZNode)) {
    try {
      List<String> children = ZKUtil.listChildrenAndWatchForNewChildren(watcher,
          watcher.assignmentZNode);
      if (children != null) {
        Stat stat = new Stat();
        for (String child : children) {
          stat.setVersion(0);
          RegionTransitionData data = ZKAssign.getDataAndWatch(watcher,
              ZKUtil.joinZNode(watcher.assignmentZNode, child), stat);
          // See HBASE-7551, handle splitting here as well, in case we miss the node change event
          if (stat.getVersion() > 0 && data.getEventType() == EventType.RS_ZK_REGION_SPLITTING) {
            handleRegion(data, stat.getVersion());
          }
        }
      }
    } catch(KeeperException e) {
      master.abort("Unexpected ZK exception reading unassigned children", e);
    }
  }
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:35,代码来源:AssignmentManager.java

示例2: createNodeSplitting

/**
 * Creates a new ephemeral node in the SPLITTING state for the specified region.
 * Create it ephemeral in case regionserver dies mid-split.
 *
 * <p>Does not transition nodes from other states.  If a node already exists
 * for this region, a {@link NodeExistsException} will be thrown.
 *
 * @param zkw zk reference
 * @param region region to be created as offline
 * @param serverName server event originates from
 * @return Version of znode created.
 * @throws KeeperException
 * @throws IOException
 */
// Copied from SplitTransaction rather than open the method over there in
// the regionserver package.
private static int createNodeSplitting(final ZooKeeperWatcher zkw,
    final HRegionInfo region, final ServerName serverName)
throws KeeperException, IOException {
  RegionTransitionData data =
    new RegionTransitionData(EventType.RS_ZK_REGION_SPLITTING,
      region.getRegionName(), serverName);

  String node = ZKAssign.getNodeName(zkw, region.getEncodedName());
  if (!ZKUtil.createEphemeralNodeAndWatch(zkw, node, data.getBytes())) {
    throw new IOException("Failed create of ephemeral " + node);
  }
  // Transition node from SPLITTING to SPLITTING and pick up version so we
  // can be sure this znode is ours; version is needed deleting.
  return transitionNodeSplitting(zkw, region, serverName, -1);
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:31,代码来源:TestAssignmentManager.java

示例3: createNodeSplitting

/**
 * Creates a new ephemeral node in the SPLITTING state for the specified region.
 * Create it ephemeral in case regionserver dies mid-split.
 *
 * <p>Does not transition nodes from other states.  If a node already exists
 * for this region, a {@link NodeExistsException} will be thrown.
 *
 * @param zkw zk reference
 * @param region region to be created as offline
 * @param serverName server event originates from
 * @return Version of znode created.
 * @throws KeeperException 
 * @throws IOException 
 */
private static int createNodeSplitting(final ZooKeeperWatcher zkw,
    final HRegionInfo region, final ServerName serverName)
throws KeeperException, IOException {
  LOG.debug(zkw.prefix("Creating ephemeral node for " +
    region.getEncodedName() + " in SPLITTING state"));
  RegionTransitionData data =
    new RegionTransitionData(EventType.RS_ZK_REGION_SPLITTING,
      region.getRegionName(), serverName);

  String node = ZKAssign.getNodeName(zkw, region.getEncodedName());
  if (!ZKUtil.createEphemeralNodeAndWatch(zkw, node, data.getBytes())) {
    throw new IOException("Failed create of ephemeral " + node);
  }
  // Transition node from SPLITTING to SPLITTING and pick up version so we
  // can be sure this znode is ours; version is needed deleting.
  return transitionNodeSplitting(zkw, region, serverName, -1);
}
 
开发者ID:lifeng5042,项目名称:RStore,代码行数:31,代码来源:SplitTransaction.java

示例4: testCaseWithSplitRegionPartial

private void testCaseWithSplitRegionPartial(boolean regionSplitDone) throws KeeperException, IOException,
    NodeExistsException, InterruptedException {
  // Create and startup an executor. This is used by AssignmentManager
  // handling zk callbacks.
  ExecutorService executor = startupMasterExecutor("testSSHWhenSplitRegionInProgress");

  // We need a mocked catalog tracker.
  CatalogTracker ct = Mockito.mock(CatalogTracker.class);
  // Create an AM.
  AssignmentManagerWithExtrasForTesting am = setUpMockedAssignmentManager(this.server, this.serverManager);
  // adding region to regions and servers maps.
  am.regionOnline(REGIONINFO, SERVERNAME_A);
  // adding region in pending close.
  am.regionsInTransition.put(REGIONINFO.getEncodedName(), new RegionState(REGIONINFO,
      State.SPLITTING, System.currentTimeMillis(), SERVERNAME_A));
  am.getZKTable().setEnabledTable(REGIONINFO.getTableNameAsString());

  RegionTransitionData data = new RegionTransitionData(EventType.RS_ZK_REGION_SPLITTING,
      REGIONINFO.getRegionName(), SERVERNAME_A);
  String node = ZKAssign.getNodeName(this.watcher, REGIONINFO.getEncodedName());
  // create znode in M_ZK_REGION_CLOSING state.
  ZKUtil.createAndWatch(this.watcher, node, data.getBytes());

  try {
    processServerShutdownHandler(ct, am, regionSplitDone, null);
    // check znode deleted or not.
    // In both cases the znode should be deleted.

    if(regionSplitDone){
      assertTrue("Region state of region in SPLITTING should be removed from rit.",
          am.regionsInTransition.isEmpty());
    }
    else{
      while (!am.assignInvoked) {
        Thread.sleep(1);
      }
      assertTrue("Assign should be invoked.", am.assignInvoked);
    }
  } finally {
    REGIONINFO.setOffline(false);
    REGIONINFO.setSplit(false);
    executor.shutdown();
    am.shutdown();
    // Clean up all znodes
    ZKAssign.deleteAllNodes(this.watcher);
  }
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:47,代码来源:TestAssignmentManager.java

示例5: createNodeSplitting

/**
 * Creates a new ephemeral node in the SPLITTING state for the specified region.
 * Create it ephemeral in case regionserver dies mid-split.
 *
 * <p>Does not transition nodes from other states.  If a node already exists
 * for this region, a {@link NodeExistsException} will be thrown.
 *
 * @param zkw zk reference
 * @param region region to be created as offline
 * @param serverName server event originates from
 * @return Version of znode created.
 * @throws KeeperException 
 * @throws IOException 
 */
void createNodeSplitting(final ZooKeeperWatcher zkw, final HRegionInfo region,
    final ServerName serverName) throws KeeperException, IOException {
  LOG.debug(zkw.prefix("Creating ephemeral node for " +
    region.getEncodedName() + " in SPLITTING state"));
  RegionTransitionData data =
    new RegionTransitionData(EventType.RS_ZK_REGION_SPLITTING,
      region.getRegionName(), serverName);

  String node = ZKAssign.getNodeName(zkw, region.getEncodedName());
  if (!ZKUtil.createEphemeralNodeAndWatch(zkw, node, data.getBytes())) {
    throw new IOException("Failed create of ephemeral " + node);
  }
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:27,代码来源:SplitTransaction.java


注:本文中的org.apache.hadoop.hbase.executor.EventHandler.EventType.RS_ZK_REGION_SPLITTING属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。