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
FieldsModifier and TypeFieldDescriptionprivate static final org.slf4j.Loggerprotected final MasterServicesprivate static final StringSet 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddeleteZooKeeper(TableName tableName) Deprecated.Since 2.0.0.protected voidfixTableState(TableState tableState) For subclasses in case they want to do fixup post hbase:meta.private voidfixTableStates(TableDescriptors tableDescriptors, Connection connection) getTablesInStates(TableState.State... states) Return all tables in given states.getTableState(TableName tableName) booleanisTablePresent(TableName tableName) booleanisTableState(TableName tableName, TableState.State... states) protected voidmetaStateDeleted(TableName tableName) protected voidmetaStateUpdated(TableName tableName, TableState.State newState) private voidDeprecated.Since 2.0.0.private TableStatereadMetaState(TableName tableName) voidsetDeletedTable(TableName tableName) voidsetTableState(TableName tableName, TableState.State newState) Set table state to provided.voidstart()private voidupdateMetaState(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_KEYflag. 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.
-