Java Code Examples for org.apache.hadoop.hbase.master.RegionState#isSplit()

The following examples show how to use org.apache.hadoop.hbase.master.RegionState#isSplit() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AssignmentManager.java    From hbase with Apache License 2.0 5 votes vote down vote up
/**
 * Used by the client (via master) to identify if all regions have the schema updates
 *
 * @param tableName
 * @return Pair indicating the status of the alter command (pending/total)
 * @throws IOException
 */
public Pair<Integer, Integer> getReopenStatus(TableName tableName) {
  if (isTableDisabled(tableName)) return new Pair<Integer, Integer>(0, 0);

  final List<RegionState> states = regionStates.getTableRegionStates(tableName);
  int ritCount = 0;
  for (RegionState regionState: states) {
    if (!regionState.isOpened() && !regionState.isSplit()) {
      ritCount++;
    }
  }
  return new Pair<Integer, Integer>(ritCount, states.size());
}
 
Example 2
Source File: AssignmentManager.java    From hbase with Apache License 2.0 5 votes vote down vote up
/**
 * Provide regions state count for given table.
 * e.g howmany regions of give table are opened/closed/rit etc
 *
 * @param tableName TableName
 * @return region states count
 */
public RegionStatesCount getRegionStatesCount(TableName tableName) {
  int openRegionsCount = 0;
  int closedRegionCount = 0;
  int ritCount = 0;
  int splitRegionCount = 0;
  int totalRegionCount = 0;
  if (!isTableDisabled(tableName)) {
    final List<RegionState> states = regionStates.getTableRegionStates(tableName);
    for (RegionState regionState : states) {
      if (regionState.isOpened()) {
        openRegionsCount++;
      } else if (regionState.isClosed()) {
        closedRegionCount++;
      } else if (regionState.isSplit()) {
        splitRegionCount++;
      }
    }
    totalRegionCount = states.size();
    ritCount = totalRegionCount - openRegionsCount - splitRegionCount;
  }
  return new RegionStatesCount.RegionStatesCountBuilder()
    .setOpenRegions(openRegionsCount)
    .setClosedRegions(closedRegionCount)
    .setSplitRegions(splitRegionCount)
    .setRegionsInTransition(ritCount)
    .setTotalRegions(totalRegionCount)
    .build();
}