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
Modifier and TypeClassDescriptionprivate static class
private static interface
Encapsulates CRUD quota operations for some subject.private static class
Holds the size of a region at the given time, millis since the epoch. -
Field Summary
Modifier and TypeFieldDescriptionprivate static final Map<RegionInfo,
Long> private boolean
private static final org.slf4j.Logger
private final MasterServices
private MasterQuotaManager.NamedLock<String>
private NamespaceAuditor
private MasterQuotaManager.NamedLock<String>
private RpcThrottleStorage
private MasterQuotaManager.NamedLock<TableName>
private MasterQuotaManager.NamedLock<String>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addRegionSize
(RegionInfo hri, long size, long time) void
checkAndUpdateNamespaceRegionQuota
(TableName tName, int regions) void
checkNamespaceTableAndRegionQuota
(TableName tName, int regions) private void
private void
int
getRegionCountOfTable
(TableName tName) Returns cached region count, or -1 if quota manager is disabled or table status not found(package private) void
boolean
private boolean
isInViolationAndPolicyDisable
(TableName tableName, QuotaObserverChore quotaObserverChore) Method to check if a table is in violation and policy set on table is DISABLE.boolean
boolean
org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.IsRpcThrottleEnabledResponse
isRpcThrottleEnabled
(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.IsRpcThrottleEnabledRequest request) void
onRegionMerged
(RegionInfo mergedRegion) Process region merge event.void
onRegionSplit
(RegionInfo hri) Process region split event.void
Process region split reverted event.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) (package private) int
pruneEntriesOlderThan
(long timeToPruneBefore, QuotaObserverChore quotaObserverChore) void
removeNamespaceQuota
(String namespace) void
removeRegionSizesForTable
(TableName tableName) Removes each region size entry where the RegionInfo references the provided TableName.void
Remove table from namespace quota.void
setNamespaceQuota
(String namespace, org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetQuotaRequest req) void
org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetQuotaResponse
setQuota
(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetQuotaRequest req) private void
setQuota
(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetQuotaRequest req, MasterQuotaManager.SetQuotaOperations quotaOps) void
setRegionServerQuota
(String regionServer, org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetQuotaRequest req) void
setTableQuota
(TableName table, org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetQuotaRequest req) void
setUserQuota
(String userName, String namespace, org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetQuotaRequest req) void
setUserQuota
(String userName, org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetQuotaRequest req) void
setUserQuota
(String userName, TableName table, org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetQuotaRequest req) void
start()
void
stop()
org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SwitchExceedThrottleQuotaResponse
switchExceedThrottleQuota
(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SwitchExceedThrottleQuotaRequest request) org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SwitchRpcThrottleResponse
switchRpcThrottle
(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:
IOException
InterruptedException
-
setUserQuota
public void setUserQuota(String userName, org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetQuotaRequest req) throws IOException, InterruptedException - Throws:
IOException
InterruptedException
-
setUserQuota
public void setUserQuota(String userName, TableName table, org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetQuotaRequest req) throws IOException, InterruptedException - Throws:
IOException
InterruptedException
-
setUserQuota
public void setUserQuota(String userName, String namespace, org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetQuotaRequest req) throws IOException, InterruptedException - Throws:
IOException
InterruptedException
-
setTableQuota
public void setTableQuota(TableName table, org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetQuotaRequest req) throws IOException, InterruptedException - Throws:
IOException
InterruptedException
-
setNamespaceQuota
public void setNamespaceQuota(String namespace, org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetQuotaRequest req) throws IOException, InterruptedException - Throws:
IOException
InterruptedException
-
setRegionServerQuota
public void setRegionServerQuota(String regionServer, org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetQuotaRequest req) throws IOException, InterruptedException - Throws:
IOException
InterruptedException
-
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:
IOException
InterruptedException
-
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:RegionStateListener
Process region merge event.- Specified by:
onRegionMerged
in interfaceRegionStateListener
- Throws:
IOException
-
onRegionSplit
Description copied from interface:RegionStateListener
Process region split event.- Specified by:
onRegionSplit
in 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:RegionStateListener
Process region split reverted event.- Specified by:
onRegionSplitReverted
in 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.
-