當前位置: 首頁>>代碼示例>>Java>>正文


Java HRegionInfo.toDelimitedByteArray方法代碼示例

本文整理匯總了Java中org.apache.hadoop.hbase.HRegionInfo.toDelimitedByteArray方法的典型用法代碼示例。如果您正苦於以下問題:Java HRegionInfo.toDelimitedByteArray方法的具體用法?Java HRegionInfo.toDelimitedByteArray怎麽用?Java HRegionInfo.toDelimitedByteArray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.hadoop.hbase.HRegionInfo的用法示例。


在下文中一共展示了HRegionInfo.toDelimitedByteArray方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: startSplitTransaction

import org.apache.hadoop.hbase.HRegionInfo; //導入方法依賴的package包/類
/**
 * Creates a new ephemeral node in the PENDING_SPLIT 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, an
 * Exception will be thrown.
 * @param parent region to be created as offline
 * @param serverName server event originates from
 * @param hri_a daughter region
 * @param hri_b daughter region
 * @throws IOException
 */

@Override
public void startSplitTransaction(HRegion parent, ServerName serverName, HRegionInfo hri_a,
    HRegionInfo hri_b) throws IOException {

  HRegionInfo region = parent.getRegionInfo();
  try {

    LOG.debug(watcher.prefix("Creating ephemeral node for " + region.getEncodedName()
        + " in PENDING_SPLIT state"));
    byte[] payload = HRegionInfo.toDelimitedByteArray(hri_a, hri_b);
    RegionTransition rt =
        RegionTransition.createRegionTransition(RS_ZK_REQUEST_REGION_SPLIT,
          region.getRegionName(), serverName, payload);
    String node = ZKAssign.getNodeName(watcher, region.getEncodedName());
    if (!ZKUtil.createEphemeralNodeAndWatch(watcher, node, rt.toByteArray())) {
      throw new IOException("Failed create of ephemeral " + node);
    }

  } catch (KeeperException e) {
    throw new IOException("Failed creating PENDING_SPLIT znode on "
        + parent.getRegionInfo().getRegionNameAsString(), e);
  }

}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:38,代碼來源:ZKSplitTransactionCoordination.java

示例2: startRegionMergeTransaction

import org.apache.hadoop.hbase.HRegionInfo; //導入方法依賴的package包/類
/**
 * Creates a new ephemeral node in the PENDING_MERGE state for the merged region.
 * Create it ephemeral in case regionserver dies mid-merge.
 *
 * <p>
 * Does not transition nodes from other states. If a node already exists for
 * this region, a {@link org.apache.zookeeper.KeeperException.NodeExistsException} will be thrown.
 *
 * @param region region to be created as offline
 * @param serverName server event originates from
 * @throws IOException
 */
@Override
public void startRegionMergeTransaction(final HRegionInfo region, final ServerName serverName,
    final HRegionInfo a, final HRegionInfo b) throws IOException {
  LOG.debug(watcher.prefix("Creating ephemeral node for " + region.getEncodedName()
      + " in PENDING_MERGE state"));
  byte[] payload = HRegionInfo.toDelimitedByteArray(region, a, b);
  RegionTransition rt =
      RegionTransition.createRegionTransition(RS_ZK_REQUEST_REGION_MERGE, region.getRegionName(),
        serverName, payload);
  String node = ZKAssign.getNodeName(watcher, region.getEncodedName());
  try {
    if (!ZKUtil.createEphemeralNodeAndWatch(watcher, node, rt.toByteArray())) {
      throw new IOException("Failed create of ephemeral " + node);
    }
  } catch (KeeperException e) {
    throw new IOException(e);
  }
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:31,代碼來源:ZkRegionMergeCoordination.java

示例3: transitionSplittingNode

import org.apache.hadoop.hbase.HRegionInfo; //導入方法依賴的package包/類
/**
 * Transitions an existing ephemeral node for the specified region which is currently in the begin
 * state to be in the end state. Master cleans up the final SPLIT znode when it reads it (or if we
 * crash, zk will clean it up).
 * <p>
 * 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.
 * <p>
 * This method can fail and return false for three different reasons:
 * <ul>
 * <li>Node for this region does not exist</li>
 * <li>Node for this region is not in the begin state</li>
 * <li>After verifying the begin state, update fails because of wrong version (this should never
 * actually happen since an RS only does this transition following a transition to the begin
 * state. If two RS are conflicting, one would fail the original transition to the begin state and
 * not this transition)</li>
 * </ul>
 * <p>
 * Does not set any watches.
 * <p>
 * This method should only be used by a RegionServer when splitting a region.
 * @param parent region to be transitioned to opened
 * @param a Daughter a of split
 * @param b Daughter b of split
 * @param serverName server event originates from
 * @param std split transaction details
 * @param beginState the expected current state the znode should be
 * @param endState the state to be transition to
 * @return version of node after transition, -1 if unsuccessful transition
 * @throws IOException
 */

private int transitionSplittingNode(HRegionInfo parent, HRegionInfo a, HRegionInfo b,
    ServerName serverName, SplitTransactionDetails std, final EventType beginState,
    final EventType endState) throws IOException {
  ZkSplitTransactionDetails zstd = (ZkSplitTransactionDetails) std;
  byte[] payload = HRegionInfo.toDelimitedByteArray(a, b);
  try {
    return ZKAssign.transitionNode(watcher, parent, serverName, beginState, endState,
      zstd.getZnodeVersion(), payload);
  } catch (KeeperException e) {
    throw new IOException(
        "Failed transition of splitting node " + parent.getRegionNameAsString(), e);
  }
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:47,代碼來源:ZKSplitTransactionCoordination.java

示例4: transitionMergingNode

import org.apache.hadoop.hbase.HRegionInfo; //導入方法依賴的package包/類
/**
 * Transitions an existing ephemeral node for the specified region which is
 * currently in the begin state to be in the end state. Master cleans up the
 * final MERGE znode when it reads it (or if we crash, zk will clean it up).
 *
 * <p>
 * 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 updated in details.
 *
 * <p>
 * This method can fail and return false for three different reasons:
 * <ul>
 * <li>Node for this region does not exist</li>
 * <li>Node for this region is not in the begin state</li>
 * <li>After verifying the begin state, update fails because of wrong version
 * (this should never actually happen since an RS only does this transition
 * following a transition to the begin state. If two RS are conflicting, one would
 * fail the original transition to the begin state and not this transition)</li>
 * </ul>
 *
 * <p>
 * Does not set any watches.
 *
 * <p>
 * This method should only be used by a RegionServer when merging two regions.
 *
 * @param merged region to be transitioned to opened
 * @param a merging region A
 * @param b merging region B
 * @param serverName server event originates from
 * @param rmd region merge details
 * @param beginState the expected current state the node should be
 * @param endState the state to be transition to
 * @throws IOException
 */
private void transitionMergingNode(HRegionInfo merged, HRegionInfo a, HRegionInfo b,
    ServerName serverName, RegionMergeDetails rmd, final EventType beginState,
    final EventType endState) throws IOException {
  ZkRegionMergeDetails zrmd = (ZkRegionMergeDetails) rmd;
  byte[] payload = HRegionInfo.toDelimitedByteArray(merged, a, b);
  try {
    zrmd.setZnodeVersion(ZKAssign.transitionNode(watcher, merged, serverName, beginState,
      endState, zrmd.getZnodeVersion(), payload));
  } catch (KeeperException e) {
    throw new IOException(e);
  }
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:49,代碼來源:ZkRegionMergeCoordination.java

示例5: getRegionInfoFileContent

import org.apache.hadoop.hbase.HRegionInfo; //導入方法依賴的package包/類
/**
 * @param hri
 * @return Content of the file we write out to the filesystem under a region
 * @throws IOException
 */
private static byte[] getRegionInfoFileContent(final HRegionInfo hri) throws IOException {
  return hri.toDelimitedByteArray();
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:9,代碼來源:HRegionFileSystem.java


注:本文中的org.apache.hadoop.hbase.HRegionInfo.toDelimitedByteArray方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。