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


Java HRegionInfo.isOffline方法代碼示例

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


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

示例1: createRegionState

import org.apache.hadoop.hbase.HRegionInfo; //導入方法依賴的package包/類
/**
 * 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,代碼行數:50,代碼來源:RegionStates.java

示例2: processDeadRegion

import org.apache.hadoop.hbase.HRegionInfo; //導入方法依賴的package包/類
/**
 * Process a dead region from a dead RS. Checks if the region is disabled or
 * disabling or if the region has a partially completed split.
 * @param hri
 * @param assignmentManager
 * @return Returns true if specified region should be assigned, false if not.
 * @throws IOException
 */
private static boolean processDeadRegion(HRegionInfo hri, AssignmentManager assignmentManager)
throws IOException {
  boolean tablePresent = assignmentManager.getTableStateManager().isTablePresent(hri.getTable());
  if (!tablePresent) {
    LOG.info("The table " + hri.getTable() + " was deleted.  Hence not proceeding.");
    return false;
  }
  // If table is not disabled but the region is offlined,
  boolean disabled = assignmentManager.getTableStateManager().isTableState(hri.getTable(),
    ZooKeeperProtos.Table.State.DISABLED);
  if (disabled){
    LOG.info("The table " + hri.getTable() + " was disabled.  Hence not proceeding.");
    return false;
  }
  if (hri.isOffline() && hri.isSplit()) {
    // HBASE-7721: Split parent and daughters are inserted into hbase:meta as an atomic operation.
    // If the meta scanner saw the parent split, then it should see the daughters as assigned
    // to the dead server. We don't have to do anything.
    return false;
  }
  boolean disabling = assignmentManager.getTableStateManager().isTableState(hri.getTable(),
    ZooKeeperProtos.Table.State.DISABLING);
  if (disabling) {
    LOG.info("The table " + hri.getTable() + " is disabled.  Hence not assigning region" +
      hri.getEncodedName());
    return false;
  }
  return true;
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:38,代碼來源:ServerCrashProcedure.java

示例3: listAllRegions

import org.apache.hadoop.hbase.HRegionInfo; //導入方法依賴的package包/類
/**
 * Lists all of the regions currently in META.
 * @param conf configuration
 * @param connection to connect with
 * @param offlined True if we are to include offlined regions, false and we'll
 * leave out offlined regions from returned list.
 * @return List of all user-space regions.
 * @throws IOException
 */
@VisibleForTesting // And for hbck.
public static List<HRegionInfo> listAllRegions(Configuration conf, Connection connection,
    final boolean offlined)
throws IOException {
  final List<HRegionInfo> regions = new ArrayList<HRegionInfo>();
  MetaScannerVisitor visitor = new MetaScannerVisitorBase() {
      @Override
      public boolean processRow(Result result) throws IOException {
        if (result == null || result.isEmpty()) {
          return true;
        }

        RegionLocations locations = MetaTableAccessor.getRegionLocations(result);
        if (locations == null) return true;
        for (HRegionLocation loc : locations.getRegionLocations()) {
          if (loc != null) {
            HRegionInfo regionInfo = loc.getRegionInfo();
            // If region offline AND we are not to include offlined regions, return.
            if (regionInfo.isOffline() && !offlined) continue;
            regions.add(regionInfo);
          }
        }
        return true;
      }
  };
  metaScan(connection, visitor);
  return regions;
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:38,代碼來源:MetaScanner.java

示例4: processRow

import org.apache.hadoop.hbase.HRegionInfo; //導入方法依賴的package包/類
@Override
public boolean processRow(Result rowResult) throws IOException {
  HRegionInfo info = getHRegionInfo(rowResult);
  if (info == null) {
    return true;
  }

  //skip over offline and split regions
  if (!(info.isOffline() || info.isSplit())) {
    return processRowInternal(rowResult);
  }
  return true;
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:14,代碼來源:MetaScanner.java


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