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


Java State.SPLIT属性代码示例

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


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

示例1: createRegionState

/**
 * Add a region to RegionStates with the specified state.
 * If the region is already in RegionStates, this call has
 * no effect, and the original state is returned.
 *
 * @param hri the region info to create a state for
 * @param newState the state to the region in set to
 * @param serverName the server the region is transitioning on
 * @param lastHost the last server that hosts the region
 * @return the current state
 */
public synchronized RegionState createRegionState(final HRegionInfo hri,
    State newState, ServerName serverName, ServerName lastHost) {
  if (newState == null || (newState == State.OPEN && serverName == null)) {
    newState =  State.OFFLINE;
  }
  if (hri.isOffline() && hri.isSplit()) {
    newState = State.SPLIT;
    serverName = null;
  }
  String encodedName = hri.getEncodedName();
  RegionState regionState = regionStates.get(encodedName);
  if (regionState != null) {
    LOG.warn("Tried to create a state for a region already in RegionStates, "
      + "used existing: " + regionState + ", ignored new: " + newState);
  } else {
    regionState = new RegionState(hri, newState, serverName);
    putRegionState(regionState);
    if (newState == State.OPEN) {
      if (!serverName.equals(lastHost)) {
        LOG.warn("Open region's last host " + lastHost
          + " should be the same as the current one " + serverName
          + ", ignored the last and used the current one");
        lastHost = serverName;
      }
      lastAssignments.put(encodedName, lastHost);
      regionAssignments.put(hri, lastHost);
    } else if (!regionState.isUnassignable()) {
      regionsInTransition.put(encodedName, regionState);
    }
    if (lastHost != null && newState != State.SPLIT) {
      addToServerHoldings(lastHost, hri);
      if (newState != State.OPEN) {
        oldAssignments.put(encodedName, lastHost);
      }
    }
  }
  return regionState;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:49,代码来源:RegionStates.java

示例2: regionOffline

/**
 * A region is offline, won't be in transition any more. Its state
 * should be the specified expected state, which can only be
 * Split/Merged/Offline/null(=Offline)/SplittingNew/MergingNew.
 */
public void regionOffline(
    final HRegionInfo hri, final State expectedState) {
  Preconditions.checkArgument(expectedState == null
    || RegionState.isUnassignable(expectedState),
      "Offlined region should not be " + expectedState);
  if (isRegionInState(hri, State.SPLITTING_NEW, State.MERGING_NEW)) {
    // Remove it from all region maps
    deleteRegion(hri);
    return;
  }
  State newState =
    expectedState == null ? State.OFFLINE : expectedState;
  updateRegionState(hri, newState);
  String encodedName = hri.getEncodedName();
  synchronized (this) {
    regionsInTransition.remove(encodedName);
    ServerName oldServerName = regionAssignments.remove(hri);
    if (oldServerName != null && serverHoldings.containsKey(oldServerName)) {
      if (newState == State.MERGED || newState == State.SPLIT
          || hri.isMetaRegion() || tableStateManager.isTableState(hri.getTable(),
            ZooKeeperProtos.Table.State.DISABLED, ZooKeeperProtos.Table.State.DISABLING)) {
        // Offline the region only if it's merged/split, or the table is disabled/disabling.
        // Otherwise, offline it from this server only when it is online on a different server.
        LOG.info("Offlined " + hri.getShortNameToLog() + " from " + oldServerName);
        removeFromServerHoldings(oldServerName, hri);
        removeFromReplicaMapping(hri);
      } else {
        // Need to remember it so that we can offline it from this
        // server when it is online on a different server.
        oldAssignments.put(encodedName, oldServerName);
      }
    }
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:39,代码来源:RegionStates.java

示例3: createRegionState

/**
 * Add a region to RegionStates with the specified state.
 * If the region is already in RegionStates, this call has
 * no effect, and the original state is returned.
 *
 * @param hri the region info to create a state for
 * @param newState the state to the region in set to
 * @param serverName the server the region is transitioning on
 * @param lastHost the last server that hosts the region
 * @return the current state
 */
public synchronized RegionState createRegionState(final HRegionInfo hri,
    State newState, ServerName serverName, ServerName lastHost) {
  if (newState == null || (newState == State.OPEN && serverName == null)) {
    newState =  State.OFFLINE;
  }
  if (hri.isOffline() && hri.isSplit()) {
    newState = State.SPLIT;
    serverName = null;
  }
  String encodedName = hri.getEncodedName();
  RegionState regionState = regionStates.get(encodedName);
  if (regionState != null) {
    LOG.warn("Tried to create a state for a region already in RegionStates, "
      + "used existing: " + regionState + ", ignored new: " + newState);
  } else {
    regionState = new RegionState(hri, newState, serverName);
    regionStates.put(encodedName, regionState);
    if (newState == State.OPEN) {
      if (!serverName.equals(lastHost)) {
        LOG.warn("Open region's last host " + lastHost
          + " should be the same as the current one " + serverName
          + ", ignored the last and used the current one");
        lastHost = serverName;
      }
      lastAssignments.put(encodedName, lastHost);
      regionAssignments.put(hri, lastHost);
    } else if (!regionState.isUnassignable()) {
      regionsInTransition.put(encodedName, regionState);
    }
    if (lastHost != null && newState != State.SPLIT) {
      addToServerHoldings(lastHost, hri);
      if (newState != State.OPEN) {
        oldAssignments.put(encodedName, lastHost);
      }
    }
  }
  return regionState;
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:49,代码来源:RegionStates.java

示例4: createRegionState

/**
 * Add a region to RegionStates. If the region is split
 * and offline, its state will be SPLIT. Otherwise, its state will
 * be OFFLINE. If it is already in RegionStates, this call has
 * no effect, and the original state is returned.
 */
public synchronized RegionState createRegionState(final HRegionInfo hri) {
  State newState = (hri.isOffline() && hri.isSplit()) ? State.SPLIT : State.OFFLINE;
  String encodedName = hri.getEncodedName();
  RegionState regionState = regionStates.get(encodedName);
  if (regionState != null) {
    LOG.warn("Tried to create a state for a region already in RegionStates, "
      + "used existing: " + regionState + ", ignored new: " + newState);
  } else {
    regionState = new RegionState(hri, newState);
    regionStates.put(encodedName, regionState);
  }
  return regionState;
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:19,代码来源:RegionStates.java


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