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

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


    String regionName = hri.getEncodedName();
    RegionState oldState = regionStates.get(regionName);
    if (oldState == null) {
      LOG.warn("Online a region not in RegionStates: " + hri.getShortNameToLog());
    } else {
      State state = oldState.getState();
      ServerName sn = oldState.getServerName();
      if (state != State.OPEN || sn == null || !sn.equals(serverName)) {
        LOG.debug("Online a region " + hri.getShortNameToLog() + " with current state=" + state +
          ", expected state=OPEN" + ", assigned to server: " + sn + " expected " + serverName);
      }
View Full Code Here


    String regionName = hri.getEncodedName();
    RegionState oldState = regionStates.get(regionName);
    if (oldState == null) {
      LOG.warn("Offline a region not in RegionStates: " + hri.getShortNameToLog());
    } else if (LOG.isDebugEnabled()) {
      State state = oldState.getState();
      ServerName sn = oldState.getServerName();
      if (state != State.OFFLINE
          && state != State.SPLITTING && state != State.MERGING) {
        LOG.debug("Offline a region " + hri.getShortNameToLog() + " with current state="
          + state + ", expected state=OFFLINE/SPLITTING/MERGING");
      }
      if (sn != null && state == State.OFFLINE) {
        LOG.debug("Offline a region " + hri.getShortNameToLog()
          + " with current state=OFFLINE, assigned to server: "
          + sn + ", expected null");
      }
    }
    State newState = expectedState;
    if (newState == null) newState = State.OFFLINE;
    updateRegionState(hri, newState);
    regionsInTransition.remove(regionName);

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

  /**
   * @return True if specified region failed to open.
   */
  public synchronized boolean isRegionFailedToOpen(final HRegionInfo hri) {
    RegionState regionState = getRegionTransitionState(hri);
    State state = regionState != null ? regionState.getState() : null;
    return state == State.FAILED_OPEN;
  }
View Full Code Here

  /**
   * @return True if specified region failed to close.
   */
  public synchronized boolean isRegionFailedToClose(final HRegionInfo hri) {
    RegionState regionState = getRegionTransitionState(hri);
    State state = regionState != null ? regionState.getState() : null;
    return state == State.FAILED_CLOSE;
  }
View Full Code Here

    String regionName = hri.getEncodedName();
    RegionState oldState = regionStates.get(regionName);
    if (oldState == null) {
      LOG.warn("Online a region not in RegionStates: " + hri);
    } else {
      State state = oldState.getState();
      ServerName sn = oldState.getServerName();
      if (state != State.OPEN || sn == null || !sn.equals(serverName)) {
        LOG.debug("Online a region with current state=" + state + ", expected state=OPEN"
          + ", assigned to server: " + sn + " expected " + serverName);
      }
View Full Code Here

    String regionName = hri.getEncodedName();
    RegionState oldState = regionStates.get(regionName);
    if (oldState == null) {
      LOG.warn("Offline a region not in RegionStates: " + hri);
    } else {
      State state = oldState.getState();
      ServerName sn = oldState.getServerName();
      if (state != State.OFFLINE || sn != null) {
        LOG.debug("Offline a region with current state=" + state + ", expected state=OFFLINE"
          + ", assigned to server: " + sn + ", expected null");
      }
View Full Code Here

      if (locations == null) continue;
      for (HRegionLocation hrl : locations) {
        HRegionInfo regionInfo = hrl.getRegionInfo();
        if (regionInfo == null) continue;
        int replicaId = regionInfo.getReplicaId();
        State state = RegionStateStore.getRegionState(result, replicaId);
        ServerName lastHost = hrl.getServerName();
        ServerName regionLocation = RegionStateStore.getRegionServer(result, replicaId);
        regionStates.createRegionState(regionInfo, state, regionLocation, lastHost);
        if (!regionStates.isRegionInState(regionInfo, State.OPEN)) {
          // Region is not open (either offline or in transition), skip
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

      return;
    }

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

    try {
      int replicaId = hri.getReplicaId();
      Put put = new Put(MetaTableAccessor.getMetaKeyForRegion(hri));
      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, getServerNameColumn(replicaId),
          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");
        MetaTableAccessor.addLocation(put, serverName, openSeqNum, replicaId);
        info.append("&openSeqNum=").append(openSeqNum);
        info.append("&server=").append(serverName);
      }
      put.addImmutable(HConstants.CATALOG_FAMILY, getStateColumn(replicaId),
        Bytes.toBytes(state.name()));
      LOG.info(info);

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

   * @return True if specified region is in one of the specified states.
   */
  public synchronized boolean isRegionInState(
      final String encodedName, final State... states) {
    RegionState regionState = getRegionState(encodedName);
    State s = regionState != null ? regionState.getState() : null;
    for (State state: states) {
      if (s == state) return true;
    }
    return false;
  }
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.