@InterfaceAudience.Private @InterfaceStability.Evolving public class MasterProcedureScheduler extends Object implements ProcedureRunnableSet
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 take smarter decision. e.g. we can abort all the operations preceding a delete table, or similar.
Modifier and Type | Class and Description |
---|---|
static class |
MasterProcedureScheduler.ProcedureEvent |
static class |
MasterProcedureScheduler.ServerQueue |
static class |
MasterProcedureScheduler.TableQueue |
Constructor and Description |
---|
MasterProcedureScheduler(org.apache.hadoop.conf.Configuration conf,
TableLockManager lockManager) |
Modifier and Type | Method and Description |
---|---|
void |
addBack(Procedure proc)
Inserts the specified element at the end of this queue.
|
void |
addFront(Procedure proc)
Inserts the specified element at the front of this queue.
|
void |
clear()
Removes all of the elements from this collection.
|
void |
completionCleanup(Procedure proc)
The procedure in execution completed.
|
long |
getNullPollCalls() |
long |
getPollCalls() |
protected boolean |
markTableAsDeleted(TableName table)
Tries to remove the queue and the table-lock of the specified table.
|
Procedure |
poll()
Fetch one Procedure from the queue
|
void |
releaseNamespaceExclusiveLock(Procedure procedure,
String nsName)
Release the exclusive lock
|
void |
releaseServerExclusiveLock(Procedure procedure,
ServerName serverName)
Release the exclusive lock
|
void |
releaseServerSharedLock(Procedure procedure,
ServerName serverName)
Release the shared lock taken
|
void |
releaseTableExclusiveLock(Procedure procedure,
TableName table)
Release the exclusive lock taken with tryAcquireTableWrite()
|
void |
releaseTableSharedLock(Procedure procedure,
TableName table)
Release the shared lock taken with tryAcquireTableRead()
|
void |
signalAll()
In case the class is blocking on poll() waiting for items to be added,
this method should awake poll() and poll() should return.
|
int |
size()
Returns the number of elements in this collection.
|
void |
suspend(MasterProcedureScheduler.ProcedureEvent event) |
boolean |
tryAcquireNamespaceExclusiveLock(Procedure procedure,
String nsName)
Try to acquire the exclusive lock on the specified namespace.
|
boolean |
tryAcquireServerExclusiveLock(Procedure procedure,
ServerName serverName)
Try to acquire the exclusive lock on the specified server.
|
boolean |
tryAcquireServerSharedLock(Procedure procedure,
ServerName serverName)
Try to acquire the shared lock on the specified server.
|
boolean |
tryAcquireTableExclusiveLock(Procedure procedure,
TableName table)
Try to acquire the exclusive lock on the specified table.
|
boolean |
tryAcquireTableSharedLock(Procedure procedure,
TableName table)
Try to acquire the shared lock on the specified table.
|
boolean |
waitEvent(MasterProcedureScheduler.ProcedureEvent event,
Procedure procedure) |
boolean |
waitEvent(MasterProcedureScheduler.ProcedureEvent event,
Procedure procedure,
boolean suspendQueue) |
void |
wake(MasterProcedureScheduler.ProcedureEvent event) |
void |
yield(Procedure proc)
The procedure can't run at the moment.
|
public MasterProcedureScheduler(org.apache.hadoop.conf.Configuration conf, TableLockManager lockManager)
public void addFront(Procedure proc)
ProcedureRunnableSet
addFront
in interface ProcedureRunnableSet
proc
- the Procedure to addpublic void addBack(Procedure proc)
ProcedureRunnableSet
addBack
in interface ProcedureRunnableSet
proc
- the Procedure to addpublic void yield(Procedure proc)
ProcedureRunnableSet
yield
in interface ProcedureRunnableSet
proc
- the Procedure to add back to the listpublic Procedure poll()
ProcedureRunnableSet
poll
in interface ProcedureRunnableSet
public void clear()
ProcedureRunnableSet
clear
in interface ProcedureRunnableSet
public void signalAll()
ProcedureRunnableSet
signalAll
in interface ProcedureRunnableSet
public int size()
ProcedureRunnableSet
size
in interface ProcedureRunnableSet
public void completionCleanup(Procedure proc)
ProcedureRunnableSet
completionCleanup
in interface ProcedureRunnableSet
proc
- the Procedure that completed the execution.public long getPollCalls()
public long getNullPollCalls()
public boolean waitEvent(MasterProcedureScheduler.ProcedureEvent event, Procedure procedure)
public boolean waitEvent(MasterProcedureScheduler.ProcedureEvent event, Procedure procedure, boolean suspendQueue)
public void suspend(MasterProcedureScheduler.ProcedureEvent event)
public void wake(MasterProcedureScheduler.ProcedureEvent event)
public boolean tryAcquireTableExclusiveLock(Procedure procedure, TableName table)
procedure
- the procedure trying to acquire the locktable
- Table to lockpublic void releaseTableExclusiveLock(Procedure procedure, TableName table)
procedure
- the procedure releasing the locktable
- the name of the table that has the exclusive lockpublic boolean tryAcquireTableSharedLock(Procedure procedure, TableName table)
procedure
- the procedure trying to acquire the locktable
- Table to lockpublic void releaseTableSharedLock(Procedure procedure, TableName table)
procedure
- the procedure releasing the locktable
- the name of the table that has the shared lockprotected boolean markTableAsDeleted(TableName table)
table
- the name of the table that should be marked as deletedpublic boolean tryAcquireNamespaceExclusiveLock(Procedure procedure, String nsName)
procedure
- the procedure trying to acquire the locknsName
- Namespace to lockreleaseNamespaceExclusiveLock(Procedure,String)
public void releaseNamespaceExclusiveLock(Procedure procedure, String nsName)
procedure
- the procedure releasing the locknsName
- the namespace that has the exclusive locktryAcquireNamespaceExclusiveLock(Procedure,String)
public boolean tryAcquireServerExclusiveLock(Procedure procedure, ServerName serverName)
procedure
- the procedure trying to acquire the lockserverName
- Server to lockreleaseServerExclusiveLock(Procedure,ServerName)
public void releaseServerExclusiveLock(Procedure procedure, ServerName serverName)
procedure
- the procedure releasing the lockserverName
- the server that has the exclusive locktryAcquireServerExclusiveLock(Procedure,ServerName)
public boolean tryAcquireServerSharedLock(Procedure procedure, ServerName serverName)
procedure
- the procedure releasing the lockserverName
- Server to lockreleaseServerSharedLock(Procedure,ServerName)
public void releaseServerSharedLock(Procedure procedure, ServerName serverName)
procedure
- the procedure releasing the lockserverName
- the server that has the shared locktryAcquireServerSharedLock(Procedure,ServerName)
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.