Package org.apache.hadoop.hbase.quotas
Class MasterQuotaManager
java.lang.Object
org.apache.hadoop.hbase.quotas.MasterQuotaManager
- All Implemented Interfaces:
RegionStateListener
Master Quota Manager. It is responsible for initialize the quota table on the first-run and
provide the admin operations to interact with the quota table. TODO: FUTURE: The master will be
responsible to notify each RS of quota changes and it will do the "quota aggregation" when the
QuotaScope is CLUSTER.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classprivate static interfaceEncapsulates CRUD quota operations for some subject.private static classHolds the size of a region at the given time, millis since the epoch. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Map<RegionInfo,Long> private booleanprivate static final org.slf4j.Loggerprivate final MasterServicesprivate MasterQuotaManager.NamedLock<String>private NamespaceAuditorprivate MasterQuotaManager.NamedLock<String>private RpcThrottleStorageprivate MasterQuotaManager.NamedLock<TableName>private MasterQuotaManager.NamedLock<String> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddRegionSize(RegionInfo hri, long size, long time) voidcheckAndUpdateNamespaceRegionQuota(TableName tName, int regions) voidcheckNamespaceTableAndRegionQuota(TableName tName, int regions) private voidprivate voidintgetRegionCountOfTable(TableName tName) Returns cached region count, or -1 if quota manager is disabled or table status not found(package private) voidbooleanprivate booleanisInViolationAndPolicyDisable(TableName tableName, QuotaObserverChore quotaObserverChore) Method to check if a table is in violation and policy set on table is DISABLE.booleanbooleanorg.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.IsRpcThrottleEnabledResponseisRpcThrottleEnabled(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.IsRpcThrottleEnabledRequest request) voidonRegionMerged(RegionInfo mergedRegion) Process region merge event.voidonRegionSplit(RegionInfo hri) Process region split event.voidProcess region split reverted event.voidprocessFileArchivals(org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.FileArchiveNotificationRequest request, Connection conn, org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.FileSystem fs) (package private) intpruneEntriesOlderThan(long timeToPruneBefore, QuotaObserverChore quotaObserverChore) voidremoveNamespaceQuota(String namespace) voidremoveRegionSizesForTable(TableName tableName) Removes each region size entry where the RegionInfo references the provided TableName.voidRemove table from namespace quota.voidsetNamespaceQuota(String namespace, org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetQuotaRequest req) voidorg.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetQuotaResponsesetQuota(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetQuotaRequest req) private voidsetQuota(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetQuotaRequest req, MasterQuotaManager.SetQuotaOperations quotaOps) voidsetRegionServerQuota(String regionServer, org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetQuotaRequest req) voidsetTableQuota(TableName table, org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetQuotaRequest req) voidsetUserQuota(String userName, String namespace, org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetQuotaRequest req) voidsetUserQuota(String userName, org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetQuotaRequest req) voidsetUserQuota(String userName, TableName table, org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetQuotaRequest req) voidstart()voidstop()org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SwitchExceedThrottleQuotaResponseswitchExceedThrottleQuota(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SwitchExceedThrottleQuotaRequest request) org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SwitchRpcThrottleResponseswitchRpcThrottle(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SwitchRpcThrottleRequest request)
-
Field Details
-
LOG
-
EMPTY_MAP
-
masterServices
-
namespaceLocks
-
tableLocks
-
userLocks
-
regionServerLocks
-
initialized
-
namespaceQuotaManager
-
regionSizes
-
rpcThrottleStorage
-
-
Constructor Details
-
MasterQuotaManager
-
-
Method Details
-
start
- Throws:
IOException
-
stop
-
isQuotaInitialized
-
setQuota
public org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetQuotaResponse setQuota(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetQuotaRequest req) throws IOException, InterruptedException - Throws:
IOExceptionInterruptedException
-
setUserQuota
public void setUserQuota(String userName, org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetQuotaRequest req) throws IOException, InterruptedException - Throws:
IOExceptionInterruptedException
-
setUserQuota
public void setUserQuota(String userName, TableName table, org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetQuotaRequest req) throws IOException, InterruptedException - Throws:
IOExceptionInterruptedException
-
setUserQuota
public void setUserQuota(String userName, String namespace, org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetQuotaRequest req) throws IOException, InterruptedException - Throws:
IOExceptionInterruptedException
-
setTableQuota
public void setTableQuota(TableName table, org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetQuotaRequest req) throws IOException, InterruptedException - Throws:
IOExceptionInterruptedException
-
setNamespaceQuota
public void setNamespaceQuota(String namespace, org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetQuotaRequest req) throws IOException, InterruptedException - Throws:
IOExceptionInterruptedException
-
setRegionServerQuota
public void setRegionServerQuota(String regionServer, org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetQuotaRequest req) throws IOException, InterruptedException - Throws:
IOExceptionInterruptedException
-
setNamespaceQuota
- Throws:
IOException
-
removeNamespaceQuota
- Throws:
IOException
-
switchRpcThrottle
public org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SwitchRpcThrottleResponse switchRpcThrottle(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SwitchRpcThrottleRequest request) throws IOException - Throws:
IOException
-
isRpcThrottleEnabled
public org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.IsRpcThrottleEnabledResponse isRpcThrottleEnabled(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.IsRpcThrottleEnabledRequest request) throws IOException - Throws:
IOException
-
isRpcThrottleEnabled
- Throws:
IOException
-
switchExceedThrottleQuota
public org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SwitchExceedThrottleQuotaResponse switchExceedThrottleQuota(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SwitchExceedThrottleQuotaRequest request) throws IOException - Throws:
IOException
-
isExceedThrottleQuotaEnabled
- Throws:
IOException
-
setQuota
private void setQuota(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetQuotaRequest req, MasterQuotaManager.SetQuotaOperations quotaOps) throws IOException, InterruptedException - Throws:
IOExceptionInterruptedException
-
checkNamespaceTableAndRegionQuota
- Throws:
IOException
-
checkAndUpdateNamespaceRegionQuota
- Throws:
IOException
-
getRegionCountOfTable
Returns cached region count, or -1 if quota manager is disabled or table status not found- Throws:
IOException
-
onRegionMerged
Description copied from interface:RegionStateListenerProcess region merge event.- Specified by:
onRegionMergedin interfaceRegionStateListener- Throws:
IOException
-
onRegionSplit
Description copied from interface:RegionStateListenerProcess region split event.- Specified by:
onRegionSplitin interfaceRegionStateListener- Parameters:
hri- An instance of RegionInfo- Throws:
IOException
-
removeTableFromNamespaceQuota
Remove table from namespace quota.- Parameters:
tName- - The table name to update quota usage.- Throws:
IOException- Signals that an I/O exception has occurred.
-
getNamespaceQuotaManager
-
checkQuotaSupport
- Throws:
IOException
-
createQuotaTable
- Throws:
IOException
-
onRegionSplitReverted
Description copied from interface:RegionStateListenerProcess region split reverted event.- Specified by:
onRegionSplitRevertedin interfaceRegionStateListener- Parameters:
hri- An instance of RegionInfo- Throws:
IOException- Signals that an I/O exception has occurred.
-
initializeRegionSizes
void initializeRegionSizes() -
addRegionSize
-
snapshotRegionSizes
-
pruneEntriesOlderThan
-
isInViolationAndPolicyDisable
private boolean isInViolationAndPolicyDisable(TableName tableName, QuotaObserverChore quotaObserverChore) Method to check if a table is in violation and policy set on table is DISABLE.- Parameters:
tableName- tableName to check.quotaObserverChore- QuotaObserverChore instance- Returns:
- returns true if table is in violation and policy is disable else false.
-
processFileArchivals
public void processFileArchivals(org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.FileArchiveNotificationRequest request, Connection conn, org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.FileSystem fs) throws IOException - Throws:
IOException
-
removeRegionSizesForTable
Removes each region size entry where the RegionInfo references the provided TableName.- Parameters:
tableName- tableName.
-