Package org.apache.hadoop.hbase.master.RegionState

Examples of org.apache.hadoop.hbase.master.RegionState.State


   * 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);
View Full Code Here


      final HRegionInfo hri, final State expectedState) {
    Preconditions.checkArgument(expectedState == null
      || RegionState.isUnassignable(expectedState),
        "Offlined region should not be " + expectedState);
    String encodedName = hri.getEncodedName();
    State newState =
      expectedState == null ? State.OFFLINE : expectedState;
    updateRegionState(hri, newState);
    regionsInTransition.remove(encodedName);

    ServerName oldServerName = regionAssignments.remove(hri);
View Full Code Here

    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);

    synchronized (this) {
      regionsInTransition.remove(hri.getEncodedName());
View Full Code Here

      return null;
    }
  }

  static boolean isOneOfStates(RegionState regionState, State... states) {
    State s = regionState != null ? regionState.getState() : null;
    for (State state: states) {
      if (s == state) return true;
    }
    return false;
  }
View Full Code Here

      Map<String, RegionState> rits = regionStates.getRegionsInTransition();
      for (RegionState regionState: rits.values()) {
        if (!serverManager.isServerOnline(regionState.getServerName())) {
          continue; // SSH will handle it
        }
        State state = regionState.getState();
        LOG.info("Processing " + regionState);
        switch (state) {
        case PENDING_OPEN:
          retrySendRegionOpen(regionState);
          break;
View Full Code Here

      new TreeMap<ServerName, List<HRegionInfo>>();
    // Iterate regions in META
    for (Result result : results) {
      HRegionInfo regionInfo = HRegionInfo.getHRegionInfo(result);
      if (regionInfo == null) continue;
      State state = RegionStateStore.getRegionState(result);
      ServerName regionLocation = RegionStateStore.getRegionServer(result);
      regionStates.createRegionState(regionInfo, state, regionLocation);
      if (!regionStates.isRegionInState(regionInfo, State.OPEN)) {
        // Region is not open (either offline or in transition), skip
        continue;
View Full Code Here

      return;
    }

    ServerName oldServer = oldState != null ? oldState.getServerName() : null;
    ServerName serverName = newState.getServerName();
    State state = newState.getState();

    try {
      Put put = new Put(hri.getRegionName());
      StringBuilder info = new StringBuilder("Updating row ");
      info.append(hri.getRegionNameAsString()).append(" with state=").append(state);
      if (serverName != null && !serverName.equals(oldServer)) {
        put.addImmutable(HConstants.CATALOG_FAMILY, HConstants.SERVERNAME_QUALIFIER,
          Bytes.toBytes(serverName.getServerName()));
        info.append("&sn=").append(serverName);
      }
      if (openSeqNum >= 0) {
        Preconditions.checkArgument(state == State.OPEN
          && serverName != null, "Open region should be on a server");
        put.addImmutable(HConstants.CATALOG_FAMILY, HConstants.SERVER_QUALIFIER,
          Bytes.toBytes(serverName.getHostAndPort()));
        put.addImmutable(HConstants.CATALOG_FAMILY, HConstants.STARTCODE_QUALIFIER,
          Bytes.toBytes(serverName.getStartcode()));
        put.addImmutable(HConstants.CATALOG_FAMILY, HConstants.SEQNUM_QUALIFIER,
          Bytes.toBytes(openSeqNum));
        info.append("&openSeqNum=").append(openSeqNum);
        info.append("&server=").append(serverName);
      }
      put.addImmutable(HConstants.CATALOG_FAMILY, HConstants.STATE_QUALIFIER,
        Bytes.toBytes(state.name()));
      LOG.info(info);


      // Persist the state change to meta
      if (metaRegion != null) {
View Full Code Here

    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);

    synchronized (this) {
      regionsInTransition.remove(hri.getEncodedName());
View Full Code Here

      return null;
    }
  }

  static boolean isOneOfStates(RegionState regionState, State... states) {
    State s = regionState != null ? regionState.getState() : null;
    for (State state: states) {
      if (s == state) return true;
    }
    return false;
  }
View Full Code Here

    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);
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hbase.master.RegionState.State

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.