Package org.apache.hadoop.hbase.master
Class TableStateManager
java.lang.Object
org.apache.hadoop.hbase.master.TableStateManager
- Direct Known Subclasses:
MirroringTableStateManager
This is a helper class used to manage table states. This class uses hbase:meta as its store for
table state so hbase:meta must be online before
start()
is called.-
Field Summary
Modifier and TypeFieldDescriptionprivate static final org.slf4j.Logger
protected final MasterServices
private static final String
Set this key to false in Configuration to disable migrating table state from zookeeper so hbase:meta table.private final ConcurrentMap<TableName,
TableState.State> private final IdReadWriteLock<TableName>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
deleteZooKeeper
(TableName tableName) Deprecated.Since 2.0.0.protected void
fixTableState
(TableState tableState) For subclasses in case they want to do fixup post hbase:meta.private void
fixTableStates
(TableDescriptors tableDescriptors, Connection connection) getTablesInStates
(TableState.State... states) Return all tables in given states.getTableState
(TableName tableName) boolean
isTablePresent
(TableName tableName) boolean
isTableState
(TableName tableName, TableState.State... states) protected void
metaStateDeleted
(TableName tableName) protected void
metaStateUpdated
(TableName tableName, TableState.State newState) private void
Deprecated.Since 2.0.0.private TableState
readMetaState
(TableName tableName) void
setDeletedTable
(TableName tableName) void
setTableState
(TableName tableName, TableState.State newState) Set table state to provided.void
start()
private void
updateMetaState
(TableName tableName, TableState.State newState)
-
Field Details
-
LOG
-
MIGRATE_TABLE_STATE_FROM_ZK_KEY
Set this key to false in Configuration to disable migrating table state from zookeeper so hbase:meta table.- See Also:
-
tnLock
-
master
-
tableName2State
-
-
Constructor Details
-
TableStateManager
TableStateManager(MasterServices master)
-
-
Method Details
-
setTableState
Set table state to provided. Caller should lock table on write.- Parameters:
tableName
- table to change state fornewState
- new state- Throws:
IOException
-
isTableState
-
setDeletedTable
- Throws:
IOException
-
isTablePresent
- Throws:
IOException
-
getTablesInStates
Return all tables in given states.- Parameters:
states
- filter by states- Returns:
- tables in given states
- Throws:
IOException
-
getTableState
- Throws:
IOException
-
updateMetaState
- Throws:
IOException
-
metaStateUpdated
- Throws:
IOException
-
metaStateDeleted
- Throws:
IOException
-
readMetaState
- Throws:
IOException
-
start
- Throws:
IOException
-
fixTableStates
private void fixTableStates(TableDescriptors tableDescriptors, Connection connection) throws IOException - Throws:
IOException
-
fixTableState
For subclasses in case they want to do fixup post hbase:meta.- Throws:
IOException
-
migrateZooKeeper
Deprecated.Since 2.0.0. Remove in hbase-3.0.0.This code is for case where a hbase2 Master is starting for the first time. ZooKeeper is where we used to keep table state. On first startup, read zookeeper and update hbase:meta with the table states found in zookeeper. This is tricky as we'll do this check every time we startup until mirroring is disabled. See theMIGRATE_TABLE_STATE_FROM_ZK_KEY
flag. Original form of this migration came in with HBASE-13032. It deleted all znodes when done. We can't do that if we want to support hbase-1.x clients who need to be able to read table state out of zk. SeeMirroringTableStateManager
.- Throws:
IOException
-
deleteZooKeeper
Deprecated.Since 2.0.0. To be removed in hbase-3.0.0.Utility method that knows how to delete the old hbase-1.x table state znode. Used also by the Mirroring subclass.
-