Package org.apache.hadoop.hbase.quotas
Class RegionServerRpcQuotaManager
java.lang.Object
org.apache.hadoop.hbase.quotas.RegionServerRpcQuotaManager
- All Implemented Interfaces:
RpcQuotaManager
@Private
@Evolving
public class RegionServerRpcQuotaManager
extends Object
implements RpcQuotaManager
Region Server Quota Manager. It is responsible to provide access to the quota information of each
user/table. The direct user of this class is the RegionServer that will get and check the
user/table quota for each operation (put, get, scan). For system tables and user/table with a
quota specified, the quota check will be a noop.
-
Field Summary
Modifier and TypeFieldDescriptionprivate static final org.slf4j.Logger
private QuotaCache
private boolean
private RpcThrottleStorage
private final RegionServerServices
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncheckBatchQuota
(Region region, int numWrites, int numReads) Check the quota for the current (rpc-context) user.checkBatchQuota
(Region region, List<org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.Action> actions, boolean hasCondition) Check the quota for the current (rpc-context) user.checkBatchQuota
(Region region, OperationQuota.OperationType type) Check the quota for the current (rpc-context) user.checkScanQuota
(Region region, org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.ScanRequest scanRequest, long maxScannerResultSize, long maxBlockBytesScanned, long prevBlockBytesScannedDifference) Check the quota for the current (rpc-context) user.Returns the quota for an operation.(package private) QuotaCache
private boolean
protected boolean
void
start
(RpcScheduler rpcScheduler) void
stop()
void
switchRpcThrottle
(boolean enable)
-
Field Details
-
LOG
-
rsServices
-
quotaCache
-
rpcThrottleEnabled
-
rpcThrottleStorage
-
-
Constructor Details
-
RegionServerRpcQuotaManager
-
-
Method Details
-
start
- Throws:
IOException
-
stop
-
isRpcThrottleEnabled
-
isQuotaEnabled
-
switchRpcThrottle
- Throws:
IOException
-
getQuotaCache
-
getQuota
public OperationQuota getQuota(org.apache.hadoop.security.UserGroupInformation ugi, TableName table, int blockSizeBytes) Returns the quota for an operation.- Parameters:
ugi
- the user that is executing the operationtable
- the table where the operation will be executed- Returns:
- the OperationQuota
-
checkScanQuota
public OperationQuota checkScanQuota(Region region, org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.ScanRequest scanRequest, long maxScannerResultSize, long maxBlockBytesScanned, long prevBlockBytesScannedDifference) throws IOException, RpcThrottlingException Description copied from interface:RpcQuotaManager
Check the quota for the current (rpc-context) user. Returns the OperationQuota used to get the available quota and to report the data/usage of the operation. This method is specific to scans because estimating a scan's workload is more complicated than estimating the workload of a get/put.- Specified by:
checkScanQuota
in interfaceRpcQuotaManager
- Parameters:
region
- the region where the operation will be performedscanRequest
- the scan to be estimated against the quotamaxScannerResultSize
- the maximum bytes to be returned by the scannermaxBlockBytesScanned
- the maximum bytes scanned in a single RPC call by the scannerprevBlockBytesScannedDifference
- the difference between BBS of the previous two next calls- Returns:
- the OperationQuota
- Throws:
RpcThrottlingException
- if the operation cannot be executed due to quota exceeded.IOException
-
checkBatchQuota
public OperationQuota checkBatchQuota(Region region, OperationQuota.OperationType type) throws IOException, RpcThrottlingException Description copied from interface:RpcQuotaManager
Check the quota for the current (rpc-context) user. Returns the OperationQuota used to get the available quota and to report the data/usage of the operation. This method does not support scans because estimating a scan's workload is more complicated than estimating the workload of a get/put.- Specified by:
checkBatchQuota
in interfaceRpcQuotaManager
- Parameters:
region
- the region where the operation will be performedtype
- the operation type- Returns:
- the OperationQuota
- Throws:
RpcThrottlingException
- if the operation cannot be executed due to quota exceeded.IOException
-
checkBatchQuota
public OperationQuota checkBatchQuota(Region region, List<org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.Action> actions, boolean hasCondition) throws IOException, RpcThrottlingException Description copied from interface:RpcQuotaManager
Check the quota for the current (rpc-context) user. Returns the OperationQuota used to get the available quota and to report the data/usage of the operation. This method does not support scans because estimating a scan's workload is more complicated than estimating the workload of a get/put.- Specified by:
checkBatchQuota
in interfaceRpcQuotaManager
- Parameters:
region
- the region where the operation will be performedactions
- the "multi" actions to performhasCondition
- whether the RegionAction has a condition- Returns:
- the OperationQuota
- Throws:
RpcThrottlingException
- if the operation cannot be executed due to quota exceeded.IOException
-
checkBatchQuota
public OperationQuota checkBatchQuota(Region region, int numWrites, int numReads) throws IOException, RpcThrottlingException Check the quota for the current (rpc-context) user. Returns the OperationQuota used to get the available quota and to report the data/usage of the operation.- Specified by:
checkBatchQuota
in interfaceRpcQuotaManager
- Parameters:
region
- the region where the operation will be performednumWrites
- number of writes to performnumReads
- number of short-reads to perform- Returns:
- the OperationQuota
- Throws:
RpcThrottlingException
- if the operation cannot be executed due to quota exceeded.RpcThrottlingException
- if the operation cannot be executed due to quota exceeded.IOException
-