@InterfaceAudience.Private public class RegionStates extends Object
Modifier and Type | Class and Description |
---|---|
private static class |
RegionStates.AssignmentProcedureEvent |
static class |
RegionStates.RegionFailedOpen |
static class |
RegionStates.RegionStateNode
Current Region State.
|
private static class |
RegionStates.RegionStateStampComparator |
private static class |
RegionStates.ServerReportEvent |
static class |
RegionStates.ServerState
Server State.
|
static class |
RegionStates.ServerStateNode
State of Server; list of hosted regions, etc.
|
Modifier and Type | Field and Description |
---|---|
private static org.slf4j.Logger |
LOG |
static RegionStates.RegionStateStampComparator |
REGION_STATE_STAMP_COMPARATOR |
private ConcurrentSkipListMap<byte[],RegionStates.RegionFailedOpen> |
regionFailedOpen |
private ConcurrentSkipListMap<RegionInfo,RegionStates.RegionStateNode> |
regionInTransition |
private ConcurrentSkipListMap<RegionInfo,RegionStates.RegionStateNode> |
regionOffline
Regions marked as offline on a read of hbase:meta.
|
private ConcurrentSkipListMap<byte[],RegionStates.RegionStateNode> |
regionsMap
RegionName -- i.e.
|
private ConcurrentHashMap<ServerName,RegionStates.ServerStateNode> |
serverMap |
protected static RegionState.State[] |
STATES_EXPECTED_ON_CLOSE |
protected static RegionState.State[] |
STATES_EXPECTED_ON_OPEN |
Constructor and Description |
---|
RegionStates() |
private static final org.slf4j.Logger LOG
protected static final RegionState.State[] STATES_EXPECTED_ON_OPEN
protected static final RegionState.State[] STATES_EXPECTED_ON_CLOSE
public static final RegionStates.RegionStateStampComparator REGION_STATE_STAMP_COMPARATOR
private final ConcurrentSkipListMap<byte[],RegionStates.RegionStateNode> regionsMap
RegionStates.RegionStateNode
private final ConcurrentSkipListMap<RegionInfo,RegionStates.RegionStateNode> regionInTransition
private final ConcurrentSkipListMap<RegionInfo,RegionStates.RegionStateNode> regionOffline
private final ConcurrentSkipListMap<byte[],RegionStates.RegionFailedOpen> regionFailedOpen
private final ConcurrentHashMap<ServerName,RegionStates.ServerStateNode> serverMap
public RegionStates()
public void clear()
public boolean isRegionInRegionStates(RegionInfo hri)
protected RegionStates.RegionStateNode createRegionStateNode(RegionInfo regionInfo)
protected RegionStates.RegionStateNode getOrCreateRegionStateNode(RegionInfo regionInfo)
RegionStates.RegionStateNode getRegionStateNodeFromName(byte[] regionName)
public RegionStates.RegionStateNode getRegionStateNode(RegionInfo regionInfo)
public void deleteRegion(RegionInfo regionInfo)
public void deleteRegions(List<RegionInfo> regionInfos)
ArrayList<RegionStates.RegionStateNode> getTableRegionStateNodes(TableName tableName)
ArrayList<RegionState> getTableRegionStates(TableName tableName)
ArrayList<RegionInfo> getTableRegionsInfo(TableName tableName)
Collection<RegionStates.RegionStateNode> getRegionStateNodes()
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)
private HRegionLocation createRegionForReopen(RegionStates.RegionStateNode node)
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)
private List<RegionInfo> getRegionsOfTable(TableName table, Predicate<RegionStates.RegionStateNode> filter)
offline
to true. Does not include regions that are in the
RegionState.State.SPLIT
state.boolean include(RegionStates.RegionStateNode node, boolean offline)
node
(do not include
if split or offline unless offline
is set to true.public List<RegionInfo> getServerRegionInfoSet(ServerName serverName)
serverName
- the server we are interested inprivate void setServerState(ServerName serverName, RegionStates.ServerState state)
public 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()
RegionStates.ServerStateNode getOrCreateServer(ServerName serverName)
getServerNode(ServerName)
where we can.public void removeServer(ServerName serverName)
public RegionStates.ServerStateNode getServerNode(ServerName serverName)
public double getAverageLoad()
RegionStates.ServerStateNode addRegionToServer(RegionStates.RegionStateNode regionNode)
public RegionStates.ServerStateNode removeRegionFromServer(ServerName serverName, RegionStates.RegionStateNode regionNode)
public static String regionNamesToString(Collection<byte[]> regions)
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.