@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:
Constructor and Description |
---|
MasterProcedureScheduler(Function<Long,Procedure<?>> procedureRetriever) |
Modifier and Type | Method and Description |
---|---|
void |
clear() |
void |
completionCleanup(Procedure proc) |
protected Procedure |
dequeue(boolean onlyUrgent) |
String |
dumpLocks()
For debugging.
|
protected void |
enqueue(Procedure proc,
boolean addFront) |
LockedResource |
getLockResource(LockedResourceType resourceType,
String resourceName) |
List<LockedResource> |
getLocks() |
protected boolean |
queueHasRunnables() |
protected int |
queueSize() |
boolean |
waitMetaExclusiveLock(Procedure<?> procedure)
Deprecated.
only used for
RecoverMetaProcedure . Should be removed along with
RecoverMetaProcedure . |
boolean |
waitNamespaceExclusiveLock(Procedure<?> procedure,
String namespace)
Suspend the procedure if the specified namespace is already locked.
|
boolean |
waitPeerExclusiveLock(Procedure<?> procedure,
String peerId)
Try to acquire the exclusive lock on the specified peer.
|
boolean |
waitRegion(Procedure<?> procedure,
RegionInfo regionInfo)
Suspend the procedure if the specified region is already locked.
|
boolean |
waitRegions(Procedure<?> procedure,
TableName table,
RegionInfo... 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 |
wakeMetaExclusiveLock(Procedure<?> procedure)
Deprecated.
only used for
RecoverMetaProcedure . Should be removed along with
RecoverMetaProcedure . |
void |
wakeNamespaceExclusiveLock(Procedure<?> procedure,
String namespace)
Wake the procedures waiting for the specified namespace
|
void |
wakePeerExclusiveLock(Procedure<?> procedure,
String peerId)
Wake the procedures waiting for the specified peer
|
void |
wakeRegion(Procedure<?> procedure,
RegionInfo regionInfo)
Wake the procedures waiting for the specified region
|
void |
wakeRegions(Procedure<?> procedure,
TableName table,
RegionInfo... 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, addBack, addFront, addFront, addFront, dequeue, getNullPollCalls, getPollCalls, hasRunnables, poll, poll, poll, poll, poll, poll, push, schedLock, schedUnlock, signalAll, size, start, stop, waitProcedure, wakePollIfNeeded, wakeProcedure, wakeWaitingProcedures
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(boolean onlyUrgent)
dequeue
in class AbstractProcedureScheduler
public List<LockedResource> getLocks()
public LockedResource getLockResource(LockedResourceType resourceType, String resourceName)
public void clear()
protected int queueSize()
queueSize
in class AbstractProcedureScheduler
public void completionCleanup(Procedure proc)
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 lockpublic boolean waitRegion(Procedure<?> procedure, RegionInfo 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, RegionInfo... 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, RegionInfo regionInfo)
procedure
- the procedure that was holding the regionregionInfo
- the region the procedure was holdingpublic void wakeRegions(Procedure<?> procedure, TableName table, RegionInfo... 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 boolean waitPeerExclusiveLock(Procedure<?> procedure, String peerId)
procedure
- the procedure trying to acquire the lockpeerId
- peer to lockwakePeerExclusiveLock(Procedure, String)
public void wakePeerExclusiveLock(Procedure<?> procedure, String peerId)
procedure
- the procedure releasing the lockpeerId
- the peer that has the exclusive lockwaitPeerExclusiveLock(Procedure, String)
@Deprecated public boolean waitMetaExclusiveLock(Procedure<?> procedure)
RecoverMetaProcedure
. Should be removed along with
RecoverMetaProcedure
.procedure
- the procedure trying to acquire the lockwakeMetaExclusiveLock(Procedure)
@Deprecated public void wakeMetaExclusiveLock(Procedure<?> procedure)
RecoverMetaProcedure
. Should be removed along with
RecoverMetaProcedure
.procedure
- the procedure releasing the lockwaitMetaExclusiveLock(Procedure)
public String dumpLocks() throws IOException
IOException
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.