@InterfaceAudience.Private public final class LockProcedure extends Procedure<MasterProcedureEnv> implements TableProcedureInterface
Procedure.LockStateTableProcedureInterface.TableOperationType| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_LOCAL_MASTER_LOCKS_TIMEOUT_MS |
static int |
DEFAULT_REMOTE_LOCKS_TIMEOUT_MS |
static String |
LOCAL_MASTER_LOCKS_TIMEOUT_MS_CONF |
static String |
REMOTE_LOCKS_TIMEOUT_MS_CONF |
NO_PROC_ID, NO_TIMEOUT| Constructor and Description |
|---|
LockProcedure() |
LockProcedure(org.apache.hadoop.conf.Configuration conf,
RegionInfo[] regionInfos,
LockType type,
String description,
CountDownLatch lockAcquireLatch)
Constructor for region lock(s).
|
LockProcedure(org.apache.hadoop.conf.Configuration conf,
String namespace,
LockType type,
String description,
CountDownLatch lockAcquireLatch)
Constructor for namespace lock.
|
LockProcedure(org.apache.hadoop.conf.Configuration conf,
TableName tableName,
LockType type,
String description,
CountDownLatch lockAcquireLatch)
Constructor for table lock.
|
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
abort(MasterProcedureEnv env) |
protected Procedure.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 Procedure<MasterProcedureEnv>[] |
execute(MasterProcedureEnv env) |
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(StringBuilder builder) |
void |
unlock(MasterProcedureEnv env) |
void |
updateHeartBeat()
Updates timeout deadline for the lock.
|
addStackIndex, afterReplay, compareTo, completionCleanup, doAcquireLock, doExecute, doReleaseLock, doRollback, elapsedTime, getChildrenLatch, getException, getLastUpdate, getNonceKey, getOwner, getParentProcId, getProcedureMetrics, getProcId, getProcIdHashCode, getProcName, getResult, getRootProcedureId, getRootProcId, getStackIndexes, getState, getSubmittedTime, getTimeout, getTimeoutTimestamp, hasChildren, hasException, hasOwner, hasParent, hasTimeout, haveSameParent, incChildrenLatch, isFailed, isFinished, isInitializing, isRunnable, isSuccess, isWaiting, isYieldAfterExecutionStep, removeStackIndex, setAbortFailure, setChildrenLatch, setFailure, setFailure, setLastUpdate, setNonceKey, setOwner, setOwner, setParentProcId, setProcId, setResult, setRootProcId, setStackIndexes, setState, setSubmittedTime, setTimeout, shouldWaitClientAck, toString, toStringClass, toStringDetails, toStringSimpleSB, toStringState, updateMetricsOnFinish, updateMetricsOnSubmit, updateTimestamp, wasExecutedpublic static final int DEFAULT_REMOTE_LOCKS_TIMEOUT_MS
public static final String REMOTE_LOCKS_TIMEOUT_MS_CONF
public static final int DEFAULT_LOCAL_MASTER_LOCKS_TIMEOUT_MS
public static final String LOCAL_MASTER_LOCKS_TIMEOUT_MS_CONF
public LockProcedure()
public LockProcedure(org.apache.hadoop.conf.Configuration conf,
String namespace,
LockType type,
String description,
CountDownLatch lockAcquireLatch)
throws IllegalArgumentException
lockAcquireLatch - if not null, the latch is decreased when lock is acquired.IllegalArgumentExceptionpublic LockProcedure(org.apache.hadoop.conf.Configuration conf,
TableName tableName,
LockType type,
String description,
CountDownLatch lockAcquireLatch)
throws IllegalArgumentException
lockAcquireLatch - if not null, the latch is decreased when lock is acquired.IllegalArgumentExceptionpublic LockProcedure(org.apache.hadoop.conf.Configuration conf,
RegionInfo[] regionInfos,
LockType type,
String description,
CountDownLatch lockAcquireLatch)
throws IllegalArgumentException
lockAcquireLatch - if not null, the latch is decreased when lock is acquired.
Useful for locks acquired locally from master process.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)
setTimeoutFailure in class Procedure<MasterProcedureEnv>public void unlock(MasterProcedureEnv env)
protected Procedure<MasterProcedureEnv>[] execute(MasterProcedureEnv env) throws ProcedureSuspendedException
execute in class Procedure<MasterProcedureEnv>ProcedureSuspendedExceptionprotected void rollback(MasterProcedureEnv env)
rollback in class Procedure<MasterProcedureEnv>protected boolean abort(MasterProcedureEnv env)
abort in class Procedure<MasterProcedureEnv>protected void serializeStateData(ProcedureStateSerializer serializer) throws IOException
serializeStateData in class Procedure<MasterProcedureEnv>IOExceptionprotected void deserializeStateData(ProcedureStateSerializer serializer) throws IOException
deserializeStateData in class Procedure<MasterProcedureEnv>IOExceptionprotected Procedure.LockState acquireLock(MasterProcedureEnv env)
acquireLock in class Procedure<MasterProcedureEnv>protected void releaseLock(MasterProcedureEnv env)
releaseLock in class Procedure<MasterProcedureEnv>protected void beforeReplay(MasterProcedureEnv env)
beforeReplay in class Procedure<MasterProcedureEnv>protected void toStringClassDetails(StringBuilder builder)
toStringClassDetails in class Procedure<MasterProcedureEnv>public LockType getType()
public String getDescription()
public boolean isLocked()
public boolean holdLock(MasterProcedureEnv env)
holdLock in class Procedure<MasterProcedureEnv>public boolean hasLock(MasterProcedureEnv env)
hasLock in class Procedure<MasterProcedureEnv>Copyright © 2007–2018 The Apache Software Foundation. All rights reserved.