@InterfaceAudience.Private public class RegionStates extends Object
Modifier and Type | Class and Description |
---|---|
static class |
RegionStates.RegionFailedOpen |
static class |
RegionStates.RegionStateNode
Current Region State.
|
static class |
RegionStates.ServerState
Server State.
|
static class |
RegionStates.ServerStateNode
State of Server; list of hosted regions, etc.
|
Modifier and Type | Field and Description |
---|---|
static org.apache.hadoop.hbase.master.assignment.RegionStates.RegionStateStampComparator |
REGION_STATE_STAMP_COMPARATOR |
protected static RegionState.State[] |
STATES_EXPECTED_ON_CLOSE |
protected static RegionState.State[] |
STATES_EXPECTED_ON_OPEN |
Constructor and Description |
---|
RegionStates() |
protected static final RegionState.State[] STATES_EXPECTED_ON_OPEN
protected static final RegionState.State[] STATES_EXPECTED_ON_CLOSE
public static final org.apache.hadoop.hbase.master.assignment.RegionStates.RegionStateStampComparator REGION_STATE_STAMP_COMPARATOR
public void clear()
public boolean isRegionInRegionStates(RegionInfo hri)
protected RegionStates.RegionStateNode createRegionStateNode(RegionInfo regionInfo)
protected RegionStates.RegionStateNode getOrCreateRegionStateNode(RegionInfo regionInfo)
public RegionStates.RegionStateNode getRegionStateNode(RegionInfo regionInfo)
public void deleteRegion(RegionInfo regionInfo)
public void deleteRegions(List<RegionInfo> regionInfos)
public ArrayList<RegionState> getRegionStates()
public RegionState getRegionState(RegionInfo regionInfo)
public RegionState getRegionState(String encodedRegionName)
public boolean hasTableRegionStates(TableName tableName)
public List<RegionInfo> getRegionsOfTable(TableName table)
public List<HRegionLocation> getRegionsOfTableForReopen(TableName tableName)
openSeqNum
in the returned HRegionLocation is also used to indicate the
state of this region, positive means the region is in RegionState.State.OPEN
, -1 means
RegionState.State.OPENING
. And for regions in other states we do not need reopen them.public HRegionLocation checkReopened(HRegionLocation oldLoc)
HRegionLocation
is the
same with getRegionsOfTableForReopen(TableName)
.
For a region which is in RegionState.State.OPEN
before, if the region state is changed or the open
seq num is changed, we can confirm that it has been reopened.
For a region which is in RegionState.State.OPENING
before, usually it will be in RegionState.State.OPEN
now and we will schedule a MRP to reopen it. But there are several exceptions:
RegionState.State.OPEN
or RegionState.State.OPENING
.RegionState.State.OPENING
state and still on the same
server, then here we will still return a HRegionLocation
for it, just like
getRegionsOfTableForReopen(TableName)
.oldLoc
- the previous state/location of this regionHRegionLocation
which
means we still need to reopen the region.getRegionsOfTableForReopen(TableName)
public List<RegionInfo> getRegionsOfTable(TableName table, boolean offline)
public List<RegionInfo> getServerRegionInfoSet(ServerName serverName)
serverName
- the server we are interested inpublic void metaLogSplitting(ServerName serverName)
metaLogSplit(ServerName)
public void metaLogSplit(ServerName serverName)
metaLogSplitting(ServerName)
public void logSplitting(ServerName serverName)
logSplit(ServerName)
public void logSplit(ServerName serverName)
logSplitting(ServerName)
public void updateRegionState(RegionInfo regionInfo, RegionState.State state)
public List<RegionInfo> getAssignedRegions()
public boolean isRegionInState(RegionInfo regionInfo, RegionState.State... state)
public boolean isRegionOnline(RegionInfo regionInfo)
public boolean isRegionOffline(RegionInfo regionInfo)
public Map<ServerName,List<RegionInfo>> getSnapShotOfAssignment(Collection<RegionInfo> regions)
public Map<RegionInfo,ServerName> getRegionAssignments()
public Map<RegionState.State,List<RegionInfo>> getRegionByStateOfTable(TableName tableName)
public ServerName getRegionServerOfRegion(RegionInfo regionInfo)
public Map<TableName,Map<ServerName,List<RegionInfo>>> getAssignmentsByTable(boolean forceByCluster)
forceByCluster
- a flag to force to aggregate the server-load to the cluster levelpublic Map<TableName,Map<ServerName,List<RegionInfo>>> getAssignmentsByTable()
protected boolean addRegionInTransition(RegionStates.RegionStateNode regionNode, RegionTransitionProcedure procedure)
protected void removeRegionInTransition(RegionStates.RegionStateNode regionNode, RegionTransitionProcedure procedure)
public boolean hasRegionsInTransition()
public boolean isRegionInTransition(RegionInfo regionInfo)
public RegionTransitionProcedure getRegionTransitionProcedure(RegionInfo hri)
hri
, return it else null.public RegionState getRegionTransitionState(RegionInfo hri)
public List<RegionStates.RegionStateNode> getRegionsInTransition()
public int getRegionsInTransitionCount()
public List<RegionState> getRegionsStateInTransition()
public SortedSet<RegionState> getRegionsInTransitionOrderedByTimestamp()
public void addToOfflineRegions(RegionStates.RegionStateNode regionNode)
public void removeFromOfflineRegions(RegionInfo regionInfo)
public RegionStates.RegionFailedOpen addToFailedOpen(RegionStates.RegionStateNode regionNode)
public RegionStates.RegionFailedOpen getFailedOpen(RegionInfo regionInfo)
public void removeFromFailedOpen(RegionInfo regionInfo)
public List<RegionState> getRegionFailedOpen()
public void removeServer(ServerName serverName)
public RegionStates.ServerStateNode getServerNode(ServerName serverName)
public double getAverageLoad()
public boolean isReplicaAvailableForRegion(RegionInfo info)
public RegionStates.ServerStateNode removeRegionFromServer(ServerName serverName, RegionStates.RegionStateNode regionNode)
public static String regionNamesToString(Collection<byte[]> regions)
Copyright © 2007–2019 Cloudera. All rights reserved.