@InterfaceAudience.Private public class AssignmentManager extends Object
RegionStates.RegionStateStore.| 限定符和类型 | 类和说明 |
|---|---|
static class |
AssignmentManager.RegionInTransitionStat |
| 限定符和类型 | 字段和说明 |
|---|---|
static String |
ASSIGN_DISPATCH_WAIT_MSEC_CONF_KEY |
static String |
ASSIGN_DISPATCH_WAITQ_MAX_CONF_KEY |
static String |
ASSIGN_MAX_ATTEMPTS |
static String |
ASSIGN_RETRY_IMMEDIATELY_MAX_ATTEMPTS |
static String |
BOOTSTRAP_THREAD_POOL_SIZE_CONF_KEY |
static String |
DEAD_REGION_METRIC_CHORE_INTERVAL_MSEC_CONF_KEY |
static String |
METRICS_RIT_STUCK_WARNING_THRESHOLD
Region in Transition metrics threshold time
|
static String |
RIT_CHORE_INTERVAL_MSEC_CONF_KEY |
| 构造器和说明 |
|---|
AssignmentManager(MasterServices master) |
| 限定符和类型 | 方法和说明 |
|---|---|
long |
assign(RegionInfo regionInfo) |
long |
assign(RegionInfo regionInfo,
ServerName sn) |
void |
checkIfShouldMoveSystemRegionAsync()
Start a new thread to check if there are region servers whose versions are higher than others.
|
AssignmentManager.RegionInTransitionStat |
computeRegionInTransitionStat() |
TransitRegionStateProcedure[] |
createAssignProcedures(List<RegionInfo> hris)
Create an array of TransitRegionStateProcedure w/o specifying a target server.
|
MergeTableRegionsProcedure |
createMergeProcedure(RegionInfo... ris) |
TransitRegionStateProcedure |
createMoveRegionProcedure(RegionInfo regionInfo,
ServerName targetServer) |
TransitRegionStateProcedure |
createOneAssignProcedure(RegionInfo hri,
boolean override)
Create one TransitRegionStateProcedure to assign a region w/o specifying a target server.
|
TransitRegionStateProcedure |
createOneUnassignProcedure(RegionInfo hri,
boolean override)
Create one TransitRegionStateProcedure to unassign a region.
|
TransitRegionStateProcedure[] |
createRoundRobinAssignProcedures(List<RegionInfo> hris)
Create round-robin assigns.
|
TransitRegionStateProcedure[] |
createRoundRobinAssignProcedures(List<RegionInfo> hris,
List<ServerName> serversToExclude)
Create round-robin assigns.
|
SplitTableRegionProcedure |
createSplitProcedure(RegionInfo regionToSplit,
byte[] splitKey) |
TransitRegionStateProcedure[] |
createUnassignProceduresForDisabling(TableName tableName)
Called by DisableTableProcedure to unassign all the regions for a table.
|
void |
deleteTable(TableName tableName)
Delete the region states.
|
List<RegionInfo> |
getAssignedRegions() |
MetricsAssignmentManager |
getAssignmentManagerMetrics() |
org.apache.hadoop.conf.Configuration |
getConfiguration() |
List<ServerName> |
getExcludedServersForSystemTable()
Get a list of servers that this region cannot be assigned to.
|
List<ServerName> |
getFavoredNodes(RegionInfo regionInfo) |
RegionInfo |
getMetaRegionFromName(byte[] regionName) |
Set<RegionInfo> |
getMetaRegionSet() |
int |
getNumRegionsOpened() |
RegionInfo |
getRegionInfo(byte[] regionName) |
List<RegionStateNode> |
getRegionsInTransition() |
List<RegionInfo> |
getRegionsOnServer(ServerName serverName)
Returns the regions hosted by the specified server.
|
RegionStates |
getRegionStates() |
RegionStatesCount |
getRegionStatesCount(TableName tableName)
Provide regions state count for given table.
|
RegionStateStore |
getRegionStateStore() |
Pair<Integer,Integer> |
getReopenStatus(TableName tableName)
Used by the client (via master) to identify if all regions have the schema updates
|
Map<ServerName,Set<byte[]>> |
getRSReports() |
Map<ServerName,List<RegionInfo>> |
getSnapShotOfAssignment(Collection<RegionInfo> regions) |
boolean |
hasRegionsInTransition() |
boolean |
isCarryingMeta(ServerName serverName) |
boolean |
isMetaAssigned()
Notice that, this only means the meta region is available on a RS, but the AM may still be
loading the region states from meta, so usually you need to check
isMetaLoaded() first
before checking this method, unless you can make sure that your piece of code can only be
executed after AM builds the region states. |
boolean |
isMetaLoaded()
Return whether AM finishes the meta loading, i.e, the region states rebuilding.
|
boolean |
isMetaRegion(byte[] regionName) |
boolean |
isMetaRegionInTransition() |
boolean |
isRunning() |
boolean |
isTableDisabled(TableName tableName) |
boolean |
isTableEnabled(TableName tableName) |
void |
joinCluster() |
void |
markRegionAsMerged(RegionInfo child,
ServerName serverName,
RegionInfo[] mergeParents)
When called here, the merge has happened.
|
void |
markRegionAsSplit(RegionInfo parent,
ServerName serverName,
RegionInfo daughterA,
RegionInfo daughterB) |
void |
move(RegionInfo regionInfo) |
Future<byte[]> |
moveAsync(RegionPlan regionPlan) |
void |
offlineRegion(RegionInfo regionInfo) |
void |
onlineRegion(RegionInfo regionInfo,
ServerName serverName) |
void |
processOfflineRegions()
Create assign procedure for offline regions.
|
protected void |
queueAssign(RegionStateNode regionNode)
Add the assign operation to the assignment queue.
|
void |
regionClosedAbnormally(RegionStateNode regionNode) |
void |
reportOnlineRegions(ServerName serverName,
Set<byte[]> regionNames)
The master will call this method when the RS send the regionServerReport().
|
org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.ReportRegionStateTransitionResponse |
reportRegionStateTransition(org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.ReportRegionStateTransitionRequest req) |
void |
setupRIT(List<TransitRegionStateProcedure> procs)
Create RegionStateNode based on the TRSP list, and attach the TRSP to the RegionStateNode.
|
void |
start() |
void |
stop() |
long |
submitServerCrash(ServerName serverName,
boolean shouldSplitWal,
boolean force)
Usually run by the Master in reaction to server crash during normal processing.
|
long |
unassign(RegionInfo regionInfo) |
boolean |
waitMetaAssigned(Procedure<?> proc,
RegionInfo regionInfo)
Notice that this event does not mean the AM has already finished region state rebuilding.
|
boolean |
waitMetaLoaded(Procedure<?> proc)
Wait until AM finishes the meta loading, i.e, the region states rebuilding.
|
public static final String BOOTSTRAP_THREAD_POOL_SIZE_CONF_KEY
public static final String ASSIGN_DISPATCH_WAIT_MSEC_CONF_KEY
public static final String ASSIGN_DISPATCH_WAITQ_MAX_CONF_KEY
public static final String RIT_CHORE_INTERVAL_MSEC_CONF_KEY
public static final String DEAD_REGION_METRIC_CHORE_INTERVAL_MSEC_CONF_KEY
public static final String ASSIGN_RETRY_IMMEDIATELY_MAX_ATTEMPTS
public AssignmentManager(MasterServices master)
public void start()
throws IOException,
org.apache.zookeeper.KeeperException
IOExceptionorg.apache.zookeeper.KeeperExceptionpublic void setupRIT(List<TransitRegionStateProcedure> procs)
This is used to restore the RIT region list, so we do not need to restore it in the loadingMeta method below. And it is also very important as now before submitting a TRSP, we need to attach it to the RegionStateNode, which acts like a guard, so we need to restore this information at the very beginning, before we start processing any procedures.
public void stop()
public boolean isRunning()
public org.apache.hadoop.conf.Configuration getConfiguration()
public MetricsAssignmentManager getAssignmentManagerMetrics()
public RegionStates getRegionStates()
public List<RegionInfo> getRegionsOnServer(ServerName serverName)
public RegionStateStore getRegionStateStore()
public List<ServerName> getFavoredNodes(RegionInfo regionInfo)
public boolean isTableEnabled(TableName tableName)
public boolean isTableDisabled(TableName tableName)
public boolean isMetaRegion(byte[] regionName)
public RegionInfo getMetaRegionFromName(byte[] regionName)
public boolean isCarryingMeta(ServerName serverName)
public Set<RegionInfo> getMetaRegionSet()
public boolean isMetaAssigned()
isMetaLoaded() first
before checking this method, unless you can make sure that your piece of code can only be
executed after AM builds the region states.isMetaLoaded()public boolean isMetaRegionInTransition()
public boolean waitMetaAssigned(Procedure<?> proc, RegionInfo regionInfo)
isMetaAssigned() for more details.isMetaAssigned()public boolean waitMetaLoaded(Procedure<?> proc)
public boolean isMetaLoaded()
public void checkIfShouldMoveSystemRegionAsync()
This method is called when a new RegionServer is added to cluster only.
public long assign(RegionInfo regionInfo, ServerName sn) throws IOException
IOExceptionpublic long assign(RegionInfo regionInfo) throws IOException
IOExceptionpublic long unassign(RegionInfo regionInfo) throws IOException
IOExceptionpublic TransitRegionStateProcedure createMoveRegionProcedure(RegionInfo regionInfo, ServerName targetServer) throws HBaseIOException
HBaseIOExceptionpublic void move(RegionInfo regionInfo) throws IOException
IOExceptionpublic Future<byte[]> moveAsync(RegionPlan regionPlan) throws HBaseIOException
HBaseIOExceptionpublic TransitRegionStateProcedure[] createRoundRobinAssignProcedures(List<RegionInfo> hris, List<ServerName> serversToExclude)
hris and a call to the balancer
to populate the assigns with targets chosen using round-robin (default balancer
scheme). If at assign-time, the target chosen is no longer up, thats fine, the
AssignProcedure will ask the balancer for a new target, and so on.public TransitRegionStateProcedure[] createRoundRobinAssignProcedures(List<RegionInfo> hris)
hris and a call to the balancer
to populate the assigns with targets chosen using round-robin (default balancer
scheme). If at assign-time, the target chosen is no longer up, thats fine, the
AssignProcedure will ask the balancer for a new target, and so on.public TransitRegionStateProcedure createOneAssignProcedure(RegionInfo hri, boolean override)
public TransitRegionStateProcedure createOneUnassignProcedure(RegionInfo hri, boolean override)
public TransitRegionStateProcedure[] createAssignProcedures(List<RegionInfo> hris)
public TransitRegionStateProcedure[] createUnassignProceduresForDisabling(TableName tableName)
public SplitTableRegionProcedure createSplitProcedure(RegionInfo regionToSplit, byte[] splitKey) throws IOException
IOExceptionpublic MergeTableRegionsProcedure createMergeProcedure(RegionInfo... ris) throws IOException
IOExceptionpublic void deleteTable(TableName tableName) throws IOException
IOExceptionpublic org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.ReportRegionStateTransitionResponse reportRegionStateTransition(org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.ReportRegionStateTransitionRequest req) throws PleaseHoldException
public void reportOnlineRegions(ServerName serverName, Set<byte[]> regionNames)
public AssignmentManager.RegionInTransitionStat computeRegionInTransitionStat()
public void joinCluster()
throws IOException
IOExceptionpublic void processOfflineRegions()
public int getNumRegionsOpened()
public long submitServerCrash(ServerName serverName, boolean shouldSplitWal, boolean force)
force - Set if the request came in externally over RPC (via hbck2). Force means
run the SCP even if it seems as though there might be an outstanding
SCP running.Procedure.NO_PROC_ID if none scheduled.public void offlineRegion(RegionInfo regionInfo)
public void onlineRegion(RegionInfo regionInfo, ServerName serverName)
public Map<ServerName,List<RegionInfo>> getSnapShotOfAssignment(Collection<RegionInfo> regions)
public Pair<Integer,Integer> getReopenStatus(TableName tableName)
tableName - IOExceptionpublic boolean hasRegionsInTransition()
public List<RegionStateNode> getRegionsInTransition()
public List<RegionInfo> getAssignedRegions()
public RegionInfo getRegionInfo(byte[] regionName)
public void regionClosedAbnormally(RegionStateNode regionNode) throws IOException
IOExceptionpublic void markRegionAsSplit(RegionInfo parent, ServerName serverName, RegionInfo daughterA, RegionInfo daughterB) throws IOException
IOExceptionpublic void markRegionAsMerged(RegionInfo child, ServerName serverName, RegionInfo[] mergeParents) throws IOException
IOExceptionprotected void queueAssign(RegionStateNode regionNode)
public List<ServerName> getExcludedServersForSystemTable()
public Map<ServerName,Set<byte[]>> getRSReports()
public RegionStatesCount getRegionStatesCount(TableName tableName)
tableName - TableNameCopyright © 2007–2020 The Apache Software Foundation. All rights reserved.