@InterfaceAudience.Private public abstract class TableLockManager extends Object
Modifier and Type | Class and Description |
---|---|
static class |
TableLockManager.NullTableLockManager
A null implementation
|
static interface |
TableLockManager.TableLock
A distributed lock for a table.
|
private static class |
TableLockManager.ZKTableLockManager
ZooKeeper based TableLockManager
|
Modifier and Type | Field and Description |
---|---|
private static boolean |
DEFAULT_TABLE_LOCK_ENABLE
by default we should enable table-level locks for schema changes
|
static long |
DEFAULT_TABLE_LOCK_EXPIRE_TIMEOUT_MS |
protected static long |
DEFAULT_TABLE_READ_LOCK_TIMEOUT_MS |
protected static long |
DEFAULT_TABLE_WRITE_LOCK_TIMEOUT_MS |
private static org.apache.commons.logging.Log |
LOG |
static String |
TABLE_LOCK_ENABLE
Configuration key for enabling table-level locks for schema changes
|
static String |
TABLE_LOCK_EXPIRE_TIMEOUT |
protected static String |
TABLE_READ_LOCK_TIMEOUT_MS
Configuration key for time out for trying to acquire table locks
|
protected static String |
TABLE_WRITE_LOCK_TIMEOUT_MS
Configuration key for time out for trying to acquire table locks
|
Constructor and Description |
---|
TableLockManager() |
Modifier and Type | Method and Description |
---|---|
static TableLockManager |
createTableLockManager(org.apache.hadoop.conf.Configuration conf,
ZooKeeperWatcher zkWatcher,
ServerName serverName)
Creates and returns a TableLockManager according to the configuration
|
static org.apache.hadoop.hbase.protobuf.generated.ZooKeeperProtos.TableLock |
fromBytes(byte[] bytes)
Public for hbck
|
abstract TableLockManager.TableLock |
readLock(TableName tableName,
String purpose)
Returns a TableLock for locking the table for shared access among read-lock holders
|
abstract void |
reapAllExpiredLocks()
Force releases all table locks(read and write) that have been held longer than
"hbase.table.lock.expire.ms".
|
abstract void |
reapWriteLocks()
Force releases table write locks and lock attempts even if this thread does
not own the lock.
|
abstract void |
tableDeleted(TableName tableName)
Called after a table has been deleted, and after the table lock is released.
|
abstract void |
visitAllLocks(InterProcessLock.MetadataHandler handler)
Visits all table locks(read and write), and lock attempts with the given callback
MetadataHandler.
|
abstract TableLockManager.TableLock |
writeLock(TableName tableName,
String purpose)
Returns a TableLock for locking the table for exclusive access
|
private static final org.apache.commons.logging.Log LOG
public static final String TABLE_LOCK_ENABLE
private static final boolean DEFAULT_TABLE_LOCK_ENABLE
protected static final String TABLE_WRITE_LOCK_TIMEOUT_MS
protected static final String TABLE_READ_LOCK_TIMEOUT_MS
protected static final long DEFAULT_TABLE_WRITE_LOCK_TIMEOUT_MS
protected static final long DEFAULT_TABLE_READ_LOCK_TIMEOUT_MS
public static final String TABLE_LOCK_EXPIRE_TIMEOUT
public static final long DEFAULT_TABLE_LOCK_EXPIRE_TIMEOUT_MS
public abstract TableLockManager.TableLock writeLock(TableName tableName, String purpose)
tableName
- Table to lockpurpose
- Human readable reason for locking the tablepublic abstract TableLockManager.TableLock readLock(TableName tableName, String purpose)
tableName
- Table to lockpurpose
- Human readable reason for locking the tablepublic abstract void visitAllLocks(InterProcessLock.MetadataHandler handler) throws IOException
handler
- the metadata handler to callIOException
- If there is an unrecoverable errorpublic abstract void reapAllExpiredLocks() throws IOException
IOException
- If there is an unrecoverable errorpublic abstract void reapWriteLocks() throws IOException
IOException
- If there is an unrecoverable errorpublic abstract void tableDeleted(TableName tableName) throws IOException
tableName
- name of the tableIOException
- If there is an unrecoverable error releasing the lockpublic static TableLockManager createTableLockManager(org.apache.hadoop.conf.Configuration conf, ZooKeeperWatcher zkWatcher, ServerName serverName)
public static org.apache.hadoop.hbase.protobuf.generated.ZooKeeperProtos.TableLock fromBytes(byte[] bytes)
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.