Class NamespaceAuditor
java.lang.Object
org.apache.hadoop.hbase.namespace.NamespaceAuditor
The Class NamespaceAuditor performs checks to ensure operations like table creation and region
splitting preserve namespace quota. The namespace quota can be specified while namespace
creation.
-
Field Summary
Modifier and TypeFieldDescriptionprivate static final org.slf4j.Logger
private MasterServices
private NamespaceStateManager
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
void
checkQuotaToCreateTable
(TableName tName, int regions) Check quota to create table.void
void
checkQuotaToUpdateRegion
(TableName tName, int regions) Check and update region count quota for an existing table.private void
void
deleteNamespace
(String namespace) int
getRegionCountOfTable
(TableName tName) Get region count for tableboolean
Checks if namespace auditor is initialized.void
removeFromNamespaceUsage
(TableName tableName) void
void
start()
void
updateQuotaForRegionMerge
(RegionInfo mergedRegion)
-
Field Details
-
LOG
-
stateManager
-
masterServices
-
-
Constructor Details
-
NamespaceAuditor
-
-
Method Details
-
start
- Throws:
IOException
-
checkQuotaToCreateTable
Check quota to create table. We add the table information to namespace state cache, assuming the operation will pass. If the operation fails, then the next time namespace state chore runs namespace state cache will be corrected.- Parameters:
tName
- - The table name to check quota.regions
- - Number of regions that will be added.- Throws:
IOException
- Signals that an I/O exception has occurred.
-
checkQuotaToUpdateRegion
Check and update region count quota for an existing table.- Parameters:
tName
- - table name for which region count to be updated.regions
- - Number of regions that will be added.- Throws:
IOException
- Signals that an I/O exception has occurred.
-
checkTableTypeAndThrowException
- Throws:
IOException
-
getRegionCountOfTable
Get region count for table- Parameters:
tName
- - table name- Returns:
- cached region count, or -1 if table status not found
- Throws:
IOException
- Signals that the namespace auditor has not been initialized
-
checkQuotaToSplitRegion
- Throws:
IOException
-
updateQuotaForRegionMerge
- Throws:
IOException
-
addNamespace
- Throws:
IOException
-
deleteNamespace
- Throws:
IOException
-
removeFromNamespaceUsage
- Throws:
IOException
-
removeRegionFromNamespaceUsage
- Throws:
IOException
-
getState
- Parameters:
namespace
- The name of the namespace- Returns:
- An instance of NamespaceTableAndRegionInfo
-
isInitialized
Checks if namespace auditor is initialized. Used only for testing.- Returns:
- true, if is initialized
-