@InterfaceAudience.Private public class AssignmentManager extends Object implements ServerListener
RegionStates
.RegionStateStore
.Modifier and Type | Class and Description |
---|---|
static class |
AssignmentManager.RegionInTransitionStat |
Modifier and Type | Field and Description |
---|---|
static String |
ASSIGN_DISPATCH_WAIT_MSEC_CONF_KEY |
static String |
ASSIGN_DISPATCH_WAITQ_MAX_CONF_KEY |
static String |
ASSIGN_MAX_ATTEMPTS |
static String |
BOOTSTRAP_THREAD_POOL_SIZE_CONF_KEY |
static String |
METRICS_RIT_STUCK_WARNING_THRESHOLD
Region in Transition metrics threshold time
|
static String |
RIT_CHORE_INTERVAL_MSEC_CONF_KEY |
Constructor and Description |
---|
AssignmentManager(MasterServices master) |
AssignmentManager(MasterServices master,
RegionStateStore stateStore) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
addRegionInTransition(RegionStates.RegionStateNode regionNode,
RegionTransitionProcedure procedure) |
void |
assign(RegionInfo regionInfo) |
void |
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() |
AssignProcedure |
createAssignProcedure(RegionInfo regionInfo)
Called by things like DisableTableProcedure to get a list of UnassignProcedure
to unassign the regions of the table.
|
AssignProcedure |
createAssignProcedure(RegionInfo regionInfo,
boolean override) |
AssignProcedure |
createAssignProcedure(RegionInfo regionInfo,
ServerName targetServer) |
AssignProcedure |
createAssignProcedure(RegionInfo regionInfo,
ServerName targetServer,
boolean override) |
AssignProcedure[] |
createAssignProcedures(List<RegionInfo> hris)
Create an array of AssignProcedures w/o specifying a target server.
|
MergeTableRegionsProcedure |
createMergeProcedure(RegionInfo regionToMergeA,
RegionInfo regionToMergeB) |
AssignProcedure[] |
createRoundRobinAssignProcedures(List<RegionInfo> hris)
Create round-robin assigns.
|
AssignProcedure[] |
createRoundRobinAssignProcedures(List<RegionInfo> hris,
List<ServerName> serversToExclude)
Create round-robin assigns.
|
SplitTableRegionProcedure |
createSplitProcedure(RegionInfo regionToSplit,
byte[] splitKey) |
UnassignProcedure |
createUnassignProcedure(RegionInfo regionInfo) |
UnassignProcedure |
createUnassignProcedure(RegionInfo regionInfo,
boolean override) |
UnassignProcedure[] |
createUnassignProcedures(TableName tableName) |
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<RegionStates.RegionStateNode> |
getRegionsInTransition() |
RegionStates |
getRegionStates() |
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,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 |
markRegionAsClosed(RegionStates.RegionStateNode regionNode) |
void |
markRegionAsClosing(RegionStates.RegionStateNode regionNode) |
void |
markRegionAsMerged(RegionInfo child,
ServerName serverName,
RegionInfo mother,
RegionInfo father)
When called here, the merge has happened.
|
void |
markRegionAsOpened(RegionStates.RegionStateNode regionNode) |
void |
markRegionAsOpening(RegionStates.RegionStateNode regionNode) |
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(RegionStates.RegionStateNode regionNode)
Add the assign operation to the assignment queue.
|
void |
registerListener(AssignmentListener listener)
Add the listener to the notification list.
|
protected void |
removeRegionInTransition(RegionStates.RegionStateNode regionNode,
RegionTransitionProcedure procedure) |
void |
reportOnlineRegions(ServerName serverName,
Set<byte[]> regionNames)
the master will call this method when the RS send the regionServerReport().
|
RegionServerStatusProtos.ReportRegionStateTransitionResponse |
reportRegionStateTransition(RegionServerStatusProtos.ReportRegionStateTransitionRequest req) |
void |
serverAdded(ServerName serverName)
The server has joined the cluster.
|
void |
serverRemoved(ServerName serverName)
The server was removed from the cluster.
|
void |
start() |
void |
stop() |
long |
submitServerCrash(ServerName serverName,
boolean shouldSplitWal) |
void |
unassign(RegionInfo regionInfo) |
void |
unassign(RegionInfo regionInfo,
boolean forceNewPlan) |
void |
undoRegionAsClosing(RegionStates.RegionStateNode regionNode) |
void |
undoRegionAsOpening(RegionStates.RegionStateNode regionNode) |
boolean |
unregisterListener(AssignmentListener listener)
Remove the listener from the notification list.
|
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.
|
protected boolean |
waitServerReportEvent(ServerName serverName,
Procedure<?> proc) |
protected void |
wakeServerReportEvent(RegionStates.ServerStateNode serverNode) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
waiting
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 ASSIGN_MAX_ATTEMPTS
public static final String METRICS_RIT_STUCK_WARNING_THRESHOLD
public AssignmentManager(MasterServices master)
public AssignmentManager(MasterServices master, RegionStateStore stateStore)
public void start() throws IOException, org.apache.zookeeper.KeeperException
IOException
org.apache.zookeeper.KeeperException
public void stop()
public boolean isRunning()
public org.apache.hadoop.conf.Configuration getConfiguration()
public MetricsAssignmentManager getAssignmentManagerMetrics()
public void registerListener(AssignmentListener listener)
listener
- The AssignmentListener to registerpublic boolean unregisterListener(AssignmentListener listener)
listener
- The AssignmentListener to unregisterpublic RegionStates getRegionStates()
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()
isMetaAssigned()
,
waitMetaLoaded(Procedure)
public void checkIfShouldMoveSystemRegionAsync()
This method is called when a new RegionServer is added to cluster only.
public void assign(RegionInfo regionInfo, ServerName sn) throws IOException
IOException
public void assign(RegionInfo regionInfo) throws IOException
IOException
public void unassign(RegionInfo regionInfo) throws IOException
IOException
public void unassign(RegionInfo regionInfo, boolean forceNewPlan) throws IOException
IOException
public void move(RegionInfo regionInfo) throws IOException
IOException
public Future<byte[]> moveAsync(RegionPlan regionPlan) throws HBaseIOException
HBaseIOException
public AssignProcedure[] 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 AssignProcedure[] 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 AssignProcedure[] createAssignProcedures(List<RegionInfo> hris)
ServerCrashProcedure
assigning regions on a server that has crashed (SCP is
also used across a cluster-restart just-in-case to ensure we do cleanup of any old WALs or
server processes).public AssignProcedure createAssignProcedure(RegionInfo regionInfo)
public AssignProcedure createAssignProcedure(RegionInfo regionInfo, boolean override)
public AssignProcedure createAssignProcedure(RegionInfo regionInfo, ServerName targetServer)
public AssignProcedure createAssignProcedure(RegionInfo regionInfo, ServerName targetServer, boolean override)
public UnassignProcedure createUnassignProcedure(RegionInfo regionInfo)
public UnassignProcedure createUnassignProcedure(RegionInfo regionInfo, boolean override)
public UnassignProcedure[] createUnassignProcedures(TableName tableName)
public SplitTableRegionProcedure createSplitProcedure(RegionInfo regionToSplit, byte[] splitKey) throws IOException
IOException
public MergeTableRegionsProcedure createMergeProcedure(RegionInfo regionToMergeA, RegionInfo regionToMergeB) throws IOException
IOException
public void deleteTable(TableName tableName) throws IOException
IOException
public RegionServerStatusProtos.ReportRegionStateTransitionResponse reportRegionStateTransition(RegionServerStatusProtos.ReportRegionStateTransitionRequest req) throws PleaseHoldException
PleaseHoldException
public void reportOnlineRegions(ServerName serverName, Set<byte[]> regionNames) throws YouAreDeadException
YouAreDeadException
protected boolean waitServerReportEvent(ServerName serverName, Procedure<?> proc)
protected void wakeServerReportEvent(RegionStates.ServerStateNode serverNode)
public AssignmentManager.RegionInTransitionStat computeRegionInTransitionStat()
public void joinCluster() throws IOException
IOException
public void processOfflineRegions()
public int getNumRegionsOpened()
public long submitServerCrash(ServerName serverName, boolean shouldSplitWal)
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
- IOException
protected boolean addRegionInTransition(RegionStates.RegionStateNode regionNode, RegionTransitionProcedure procedure)
protected void removeRegionInTransition(RegionStates.RegionStateNode regionNode, RegionTransitionProcedure procedure)
public boolean hasRegionsInTransition()
public List<RegionStates.RegionStateNode> getRegionsInTransition()
public List<RegionInfo> getAssignedRegions()
public RegionInfo getRegionInfo(byte[] regionName)
public void markRegionAsOpening(RegionStates.RegionStateNode regionNode) throws IOException
IOException
public void undoRegionAsOpening(RegionStates.RegionStateNode regionNode)
public void markRegionAsOpened(RegionStates.RegionStateNode regionNode) throws IOException
IOException
public void markRegionAsClosing(RegionStates.RegionStateNode regionNode) throws IOException
IOException
public void undoRegionAsClosing(RegionStates.RegionStateNode regionNode)
public void markRegionAsClosed(RegionStates.RegionStateNode regionNode) throws IOException
IOException
public void markRegionAsSplit(RegionInfo parent, ServerName serverName, RegionInfo daughterA, RegionInfo daughterB) throws IOException
IOException
public void markRegionAsMerged(RegionInfo child, ServerName serverName, RegionInfo mother, RegionInfo father) throws IOException
IOException
protected void queueAssign(RegionStates.RegionStateNode regionNode)
public List<ServerName> getExcludedServersForSystemTable()
public void serverAdded(ServerName serverName)
ServerListener
serverAdded
in interface ServerListener
serverName
- The remote servers name.public void serverRemoved(ServerName serverName)
ServerListener
serverRemoved
in interface ServerListener
serverName
- The remote servers name.Copyright © 2007–2019 Cloudera. All rights reserved.