@InterfaceAudience.Private public class MasterProcedureScheduler extends AbstractProcedureScheduler
Each procedure should implement an Interface providing information for this queue. For example table related procedures should implement TableProcedureInterface. Each procedure will be pushed in its own queue, and based on the operation type we may make smarter decisions: e.g. we can abort all the operations preceding a delete table, or similar.
AbstractProcedureScheduler.push(Procedure, boolean, boolean)
: A push will add a Queue back to run-queue
when:
AbstractProcedureScheduler.poll(long)
: A poll will remove a Queue from run-queue when:
Modifier and Type | Class and Description |
---|---|
static class |
MasterProcedureScheduler.ServerQueue |
static class |
MasterProcedureScheduler.TableQueue |
Constructor and Description |
---|
MasterProcedureScheduler(org.apache.hadoop.conf.Configuration conf) |
Modifier and Type | Method and Description |
---|---|
void |
clear() |
protected void |
clearQueue() |
void |
completionCleanup(Procedure proc) |
protected Procedure |
dequeue() |
String |
dumpLocks()
For debugging.
|
protected void |
enqueue(Procedure proc,
boolean addFront) |
LockedResource |
getLockResource(LockedResourceType resourceType,
String resourceName) |
List<LockedResource> |
getLocks() |
protected void |
logLockedResource(LockedResourceType resourceType,
String resourceName)
Get lock info for a resource of specified type and name and log details
|
protected boolean |
markTableAsDeleted(TableName table,
Procedure procedure)
Tries to remove the queue and the table-lock of the specified table.
|
protected boolean |
queueHasRunnables() |
protected int |
queueSize() |
boolean |
waitNamespaceExclusiveLock(Procedure procedure,
String namespace)
Suspend the procedure if the specified namespace is already locked.
|
boolean |
waitRegion(Procedure procedure,
HRegionInfo regionInfo)
Suspend the procedure if the specified region is already locked.
|
boolean |
waitRegions(Procedure procedure,
TableName table,
HRegionInfo... regionInfo)
Suspend the procedure if the specified set of regions are already locked.
|
boolean |
waitServerExclusiveLock(Procedure procedure,
ServerName serverName)
Try to acquire the exclusive lock on the specified server.
|
boolean |
waitTableExclusiveLock(Procedure procedure,
TableName table)
Suspend the procedure if the specified table is already locked.
|
boolean |
waitTableSharedLock(Procedure procedure,
TableName table)
Suspend the procedure if the specified table is already locked.
|
void |
wakeNamespaceExclusiveLock(Procedure procedure,
String namespace)
Wake the procedures waiting for the specified namespace
|
void |
wakeRegion(Procedure procedure,
HRegionInfo regionInfo)
Wake the procedures waiting for the specified region
|
void |
wakeRegions(Procedure procedure,
TableName table,
HRegionInfo... regionInfo)
Wake the procedures waiting for the specified regions
|
void |
wakeServerExclusiveLock(Procedure procedure,
ServerName serverName)
Wake the procedures waiting for the specified server
|
void |
wakeTableExclusiveLock(Procedure procedure,
TableName table)
Wake the procedures waiting for the specified table
|
void |
wakeTableSharedLock(Procedure procedure,
TableName table)
Wake the procedures waiting for the specified table
|
void |
yield(Procedure proc) |
addBack, addFront, getNullPollCalls, getPollCalls, hasRunnables, poll, poll, poll, push, schedLock, schedUnlock, signalAll, size, start, stop, suspendEvent, waitEvent, waitProcedure, wakeEvent, wakeEvents, wakePollIfNeeded, wakeProcedure, wakeWaitingProcedures
public MasterProcedureScheduler(org.apache.hadoop.conf.Configuration conf)
public void yield(Procedure proc)
protected void enqueue(Procedure proc, boolean addFront)
enqueue
in class AbstractProcedureScheduler
protected boolean queueHasRunnables()
queueHasRunnables
in class AbstractProcedureScheduler
protected Procedure dequeue()
dequeue
in class AbstractProcedureScheduler
public List<LockedResource> getLocks()
public LockedResource getLockResource(LockedResourceType resourceType, String resourceName)
public void clear()
protected void clearQueue()
protected int queueSize()
queueSize
in class AbstractProcedureScheduler
public void completionCleanup(Procedure proc)
protected void logLockedResource(LockedResourceType resourceType, String resourceName)
public boolean waitTableExclusiveLock(Procedure procedure, TableName table)
procedure
- the procedure trying to acquire the locktable
- Table to lockpublic void wakeTableExclusiveLock(Procedure procedure, TableName table)
procedure
- the procedure releasing the locktable
- the name of the table that has the exclusive lockpublic boolean waitTableSharedLock(Procedure procedure, TableName table)
procedure
- the procedure trying to acquire the locktable
- Table to lockpublic void wakeTableSharedLock(Procedure procedure, TableName table)
procedure
- the procedure releasing the locktable
- the name of the table that has the shared lockprotected boolean markTableAsDeleted(TableName table, Procedure procedure)
table
- the name of the table that should be marked as deletedprocedure
- the procedure that is removing the tablepublic boolean waitRegion(Procedure procedure, HRegionInfo regionInfo)
procedure
- the procedure trying to acquire the lock on the regionregionInfo
- the region we are trying to lockpublic boolean waitRegions(Procedure procedure, TableName table, HRegionInfo... regionInfo)
procedure
- the procedure trying to acquire the lock on the regionstable
- the table name of the regions we are trying to lockregionInfo
- the list of regions we are trying to lockpublic void wakeRegion(Procedure procedure, HRegionInfo regionInfo)
procedure
- the procedure that was holding the regionregionInfo
- the region the procedure was holdingpublic void wakeRegions(Procedure procedure, TableName table, HRegionInfo... regionInfo)
procedure
- the procedure that was holding the regionsregionInfo
- the list of regions the procedure was holdingpublic boolean waitNamespaceExclusiveLock(Procedure procedure, String namespace)
procedure
- the procedure trying to acquire the locknamespace
- Namespace to lockwakeNamespaceExclusiveLock(Procedure,String)
public void wakeNamespaceExclusiveLock(Procedure procedure, String namespace)
procedure
- the procedure releasing the locknamespace
- the namespace that has the exclusive lockwaitNamespaceExclusiveLock(Procedure,String)
public boolean waitServerExclusiveLock(Procedure procedure, ServerName serverName)
procedure
- the procedure trying to acquire the lockserverName
- Server to lockwakeServerExclusiveLock(Procedure,ServerName)
public void wakeServerExclusiveLock(Procedure procedure, ServerName serverName)
procedure
- the procedure releasing the lockserverName
- the server that has the exclusive lockwaitServerExclusiveLock(Procedure,ServerName)
public String dumpLocks() throws IOException
IOException
Copyright © 2007–2017 The Apache Software Foundation. All rights reserved.