public final class LockProcedure extends <any> implements TableProcedureInterface
TableProcedureInterface.TableOperationType| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_LOCAL_MASTER_LOCKS_TIMEOUT_MS |
static int |
DEFAULT_REMOTE_LOCKS_TIMEOUT_MS |
static java.lang.String |
LOCAL_MASTER_LOCKS_TIMEOUT_MS_CONF |
static java.lang.String |
REMOTE_LOCKS_TIMEOUT_MS_CONF |
| Constructor and Description |
|---|
LockProcedure() |
LockProcedure(Configuration conf,
RegionInfo[] regionInfos,
LockType type,
java.lang.String description,
java.util.concurrent.CountDownLatch lockAcquireLatch)
Constructor for region lock(s).
|
LockProcedure(Configuration conf,
java.lang.String namespace,
LockType type,
java.lang.String description,
java.util.concurrent.CountDownLatch lockAcquireLatch)
Constructor for namespace lock.
|
LockProcedure(Configuration conf,
TableName tableName,
LockType type,
java.lang.String description,
java.util.concurrent.CountDownLatch lockAcquireLatch)
Constructor for table lock.
|
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
abort(MasterProcedureEnv env) |
protected LockState |
acquireLock(MasterProcedureEnv env) |
protected void |
beforeReplay(MasterProcedureEnv env)
On recovery, re-execute from start to acquire the locks.
|
protected void |
deserializeStateData(ProcedureStateSerializer serializer) |
protected <any>[] |
execute(MasterProcedureEnv env) |
java.lang.String |
getDescription() |
TableName |
getTableName() |
TableProcedureInterface.TableOperationType |
getTableOperationType()
Given an operation type we can take decisions about what to do with pending operations.
|
LockType |
getType() |
boolean |
hasLock(MasterProcedureEnv env) |
boolean |
holdLock(MasterProcedureEnv env) |
boolean |
isLocked() |
protected void |
releaseLock(MasterProcedureEnv env) |
protected void |
rollback(MasterProcedureEnv env) |
protected void |
serializeStateData(ProcedureStateSerializer serializer) |
protected boolean |
setTimeoutFailure(MasterProcedureEnv env)
Re run the procedure after every timeout to write new WAL entries so we don't hold back old
WALs.
|
protected void |
toStringClassDetails(java.lang.StringBuilder builder) |
void |
unlock(MasterProcedureEnv env) |
void |
updateHeartBeat()
Updates timeout deadline for the lock.
|
public static final int DEFAULT_REMOTE_LOCKS_TIMEOUT_MS
public static final java.lang.String REMOTE_LOCKS_TIMEOUT_MS_CONF
public static final int DEFAULT_LOCAL_MASTER_LOCKS_TIMEOUT_MS
public static final java.lang.String LOCAL_MASTER_LOCKS_TIMEOUT_MS_CONF
public LockProcedure()
public LockProcedure(Configuration conf,
java.lang.String namespace,
LockType type,
java.lang.String description,
java.util.concurrent.CountDownLatch lockAcquireLatch)
throws java.lang.IllegalArgumentException
lockAcquireLatch - if not null, the latch is decreased when lock is acquired.java.lang.IllegalArgumentExceptionpublic LockProcedure(Configuration conf,
TableName tableName,
LockType type,
java.lang.String description,
java.util.concurrent.CountDownLatch lockAcquireLatch)
throws java.lang.IllegalArgumentException
lockAcquireLatch - if not null, the latch is decreased when lock is acquired.java.lang.IllegalArgumentExceptionpublic LockProcedure(Configuration conf,
RegionInfo[] regionInfos,
LockType type,
java.lang.String description,
java.util.concurrent.CountDownLatch lockAcquireLatch)
throws java.lang.IllegalArgumentException
lockAcquireLatch - if not null, the latch is decreased when lock is acquired.
Useful for locks acquired locally from master process.java.lang.IllegalArgumentException - if all regions are not from same table.public TableName getTableName()
getTableName in interface TableProcedureInterfacepublic TableProcedureInterface.TableOperationType getTableOperationType()
TableProcedureInterfacegetTableOperationType in interface TableProcedureInterfacepublic void updateHeartBeat()
protected boolean setTimeoutFailure(MasterProcedureEnv env)
public void unlock(MasterProcedureEnv env)
protected <any>[] execute(MasterProcedureEnv env) throws ProcedureSuspendedException
ProcedureSuspendedExceptionprotected void rollback(MasterProcedureEnv env)
protected boolean abort(MasterProcedureEnv env)
protected void serializeStateData(ProcedureStateSerializer serializer)
throws java.io.IOException
java.io.IOExceptionprotected void deserializeStateData(ProcedureStateSerializer serializer)
throws java.io.IOException
java.io.IOExceptionprotected LockState acquireLock(MasterProcedureEnv env)
protected void releaseLock(MasterProcedureEnv env)
protected void beforeReplay(MasterProcedureEnv env)
protected void toStringClassDetails(java.lang.StringBuilder builder)
public LockType getType()
public java.lang.String getDescription()
public boolean isLocked()
public boolean holdLock(MasterProcedureEnv env)
public boolean hasLock(MasterProcedureEnv env)