Class NamespaceStateManager
java.lang.Object
org.apache.hadoop.hbase.namespace.NamespaceStateManager
NamespaceStateManager manages state (in terms of quota) of all the namespaces. It contains a
cache which is updated based on the hooks in the NamespaceAuditor class.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate static final org.slf4j.Loggerprivate final MasterServicesprivate final ConcurrentMap<String,NamespaceTableAndRegionInfo> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) NamespaceTableAndRegionInfoaddNamespace(String namespace) private void(package private) booleancheckAndUpdateNamespaceRegionCount(TableName name, byte[] regionName, int incr) Check if adding a region violates namespace quota, if not update namespace cache.(package private) voidcheckAndUpdateNamespaceRegionCount(TableName name, int incr) Check and update region count for an existing table.(package private) voidcheckAndUpdateNamespaceTableCount(TableName table, int numRegions) (package private) voiddeleteNamespace(String namespace) Delete the namespace state.private NamespaceDescriptorgetNamespaceDescriptor(String namespaceAsString) Gets an instance of NamespaceTableAndRegionInfo associated with namespace.private voidInitialize namespace state cache by scanning meta table.(package private) booleanvoid(package private) voidremoveTable(TableName tableName) voidstart()Starts the NamespaceStateManager.
-
Field Details
-
LOG
-
nsStateCache
-
master
-
initialized
-
-
Constructor Details
-
NamespaceStateManager
-
-
Method Details
-
start
Starts the NamespaceStateManager. The boot strap of cache is done in the post master start hook of the NamespaceAuditor class.- Throws:
IOException- Signals that an I/O exception has occurred.
-
getState
Gets an instance of NamespaceTableAndRegionInfo associated with namespace.- Parameters:
name- The name of the namespace- Returns:
- An instance of NamespaceTableAndRegionInfo.
-
checkAndUpdateNamespaceRegionCount
boolean checkAndUpdateNamespaceRegionCount(TableName name, byte[] regionName, int incr) throws IOException Check if adding a region violates namespace quota, if not update namespace cache.- Returns:
- true, if region can be added to table.
- Throws:
IOException- Signals that an I/O exception has occurred.
-
checkAndUpdateNamespaceRegionCount
Check and update region count for an existing table. To handle scenarios like restore snapshot- Parameters:
name- name of the table for region count needs to be checked and updatedincr- count of regions- Throws:
QuotaExceededException- if quota exceeds for the number of regions allowed in a namespaceIOException- Signals that an I/O exception has occurred.
-
getNamespaceDescriptor
-
checkAndUpdateNamespaceTableCount
- Throws:
IOException
-
addNamespace
-
deleteNamespace
Delete the namespace state.- Parameters:
namespace- the name of the namespace to delete
-
addTable
- Throws:
IOException
-
removeTable
-
initialize
Initialize namespace state cache by scanning meta table.- Throws:
IOException
-
isInitialized
boolean isInitialized() -
removeRegionFromTable
- Throws:
IOException
-