@InterfaceAudience.Private public class RegionStates extends Object
Modifier and Type | Class and Description |
---|---|
static class |
RegionStates.RegionFailedOpen |
private static class |
RegionStates.RegionStateStampComparator |
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,RegionStateNode> |
regionInTransition |
private ConcurrentSkipListMap<RegionInfo,RegionStateNode> |
regionOffline
Regions marked as offline on a read of hbase:meta.
|
private ConcurrentSkipListMap<byte[],RegionStateNode> |
regionsMap
RegionName -- i.e.
|
private ConcurrentHashMap<ServerName,ServerStateNode> |
serverMap |
Constructor and Description |
---|
RegionStates() |
private static final org.slf4j.Logger LOG
public static final RegionStates.RegionStateStampComparator REGION_STATE_STAMP_COMPARATOR
private final ConcurrentSkipListMap<byte[],RegionStateNode> regionsMap
RegionStateNode
private final ConcurrentSkipListMap<RegionInfo,RegionStateNode> regionInTransition
private final ConcurrentSkipListMap<RegionInfo,RegionStateNode> regionOffline
private final ConcurrentSkipListMap<byte[],RegionStates.RegionFailedOpen> regionFailedOpen
private final ConcurrentHashMap<ServerName,ServerStateNode> serverMap
public RegionStates()
public void clear()
public boolean isRegionInRegionStates(RegionInfo hri)
RegionStateNode createRegionStateNode(RegionInfo regionInfo)
public RegionStateNode getOrCreateRegionStateNode(RegionInfo regionInfo)
RegionStateNode getRegionStateNodeFromName(byte[] regionName)
public RegionStateNode getRegionStateNode(RegionInfo regionInfo)
public void deleteRegion(RegionInfo regionInfo)
public void deleteRegions(List<RegionInfo> regionInfos)
ArrayList<RegionStateNode> getTableRegionStateNodes(TableName tableName)
ArrayList<RegionState> getTableRegionStates(TableName tableName)
ArrayList<RegionInfo> getTableRegionsInfo(TableName tableName)
public Collection<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(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<RegionStateNode> filter)
offline
to true. Does not include regions that are in the
RegionState.State.SPLIT
state.boolean include(RegionStateNode node, boolean offline)
node
(do not include
if split or offline unless offline
is set to true.private void setServerState(ServerName serverName, 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)
private void createSnapshot(RegionStateNode node, Map<ServerName,List<RegionInfo>> result)
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>>> getAssignmentsForBalancer(TableStateManager tableStateManager, List<ServerName> onlineServers)
private boolean isTableDisabled(TableStateManager tableStateManager, TableName tableName)
public boolean hasRegionsInTransition()
public boolean isRegionInTransition(RegionInfo regionInfo)
public RegionState getRegionTransitionState(RegionInfo hri)
public List<RegionStateNode> getRegionsInTransition()
public int getRegionsInTransitionCount()
public List<RegionState> getRegionsStateInTransition()
public SortedSet<RegionState> getRegionsInTransitionOrderedByTimestamp()
public void addToOfflineRegions(RegionStateNode regionNode)
public void removeFromOfflineRegions(RegionInfo regionInfo)
public RegionStates.RegionFailedOpen addToFailedOpen(RegionStateNode regionNode)
public RegionStates.RegionFailedOpen getFailedOpen(RegionInfo regionInfo)
public void removeFromFailedOpen(RegionInfo regionInfo)
public List<RegionState> getRegionFailedOpen()
public ServerStateNode getOrCreateServer(ServerName serverName)
getServerNode(ServerName)
where we can.public void removeServer(ServerName serverName)
public ServerStateNode getServerNode(ServerName serverName)
public double getAverageLoad()
public ServerStateNode addRegionToServer(RegionStateNode regionNode)
public ServerStateNode removeRegionFromServer(ServerName serverName, RegionStateNode regionNode)
public static String regionNamesToString(Collection<byte[]> regions)
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.