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
Modifier and TypeFieldDescriptionprivate boolean
private static final org.slf4j.Logger
private MasterServices
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription(package private) NamespaceTableAndRegionInfo
addNamespace
(String namespace) private void
(package private) boolean
checkAndUpdateNamespaceRegionCount
(TableName name, byte[] regionName, int incr) Check if adding a region violates namespace quota, if not update namespace cache.(package private) void
checkAndUpdateNamespaceRegionCount
(TableName name, int incr) Check and update region count for an existing table.(package private) void
checkAndUpdateNamespaceTableCount
(TableName table, int numRegions) (package private) void
deleteNamespace
(String namespace) Delete the namespace state.private NamespaceDescriptor
getNamespaceDescriptor
(String namespaceAsString) Gets an instance of NamespaceTableAndRegionInfo associated with namespace.private void
Initialize namespace state cache by scanning meta table.(package private) boolean
void
(package private) void
removeTable
(TableName tableName) void
start()
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
-