Package org.apache.hadoop.hbase.quotas
Interface OperationQuota
- All Known Implementing Classes:
DefaultOperationQuota
,ExceedOperationQuota
,NoopOperationQuota
Interface that allows to check the quota available for an operation.
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
If false, the default, then IO based throttles will consume read availability based on the block bytes scanned by the given request.static final boolean
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addGetResult
(Result result) Add a get result.void
addMutation
(Mutation mutation) Add a mutation result.void
addScanResult
(List<Result> results) Add a scan result.void
checkBatchQuota
(int numWrites, int numReads) Checks if it is possible to execute the specified operation.void
checkScanQuota
(org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.ScanRequest scanRequest, long maxScannerResultSize, long maxBlockBytesScanned, long prevBlockBytesScannedDifference) Checks if it is possible to execute the scan.void
close()
Cleanup method on operation completiondefault long
Returns the maximum result size to be returned by the given operation.long
Returns the number of bytes available to read to avoid exceeding the quotalong
Returns the number of bytes consumed from the quota by the operation
-
Field Details
-
USE_RESULT_SIZE_BYTES
If false, the default, then IO based throttles will consume read availability based on the block bytes scanned by the given request. If true then IO based throttles will use result size rather than block bytes scanned. Using block bytes scanned should be preferable to using result size, because otherwise access patterns like heavily filtered scans may be able to produce a significant and effectively un-throttled workload.- See Also:
-
USE_RESULT_SIZE_BYTES_DEFAULT
- See Also:
-
-
Method Details
-
checkBatchQuota
Checks if it is possible to execute the specified operation. The quota will be estimated based on the number of operations to perform and the average size accumulated during time.- Parameters:
numWrites
- number of write operation that will be performednumReads
- number of small-read operation that will be performed- Throws:
RpcThrottlingException
- if the operation cannot be performed because RPC quota is exceeded.
-
checkScanQuota
void checkScanQuota(org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.ScanRequest scanRequest, long maxScannerResultSize, long maxBlockBytesScanned, long prevBlockBytesScannedDifference) throws RpcThrottlingException Checks if it is possible to execute the scan. The quota will be estimated based on the composition of the scan.- Parameters:
scanRequest
- the given scan operationmaxScannerResultSize
- 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- Throws:
RpcThrottlingException
- if the operation cannot be performed because RPC quota is exceeded.
-
close
void close()Cleanup method on operation completion -
addGetResult
Add a get result. This will be used to calculate the exact quota and have a better short-read average size for the next time. -
addScanResult
Add a scan result. This will be used to calculate the exact quota and have a better long-read average size for the next time. -
addMutation
Add a mutation result. This will be used to calculate the exact quota and have a better mutation average size for the next time. -
getReadAvailable
long getReadAvailable()Returns the number of bytes available to read to avoid exceeding the quota -
getReadConsumed
long getReadConsumed()Returns the number of bytes consumed from the quota by the operation -
getMaxResultSize
Returns the maximum result size to be returned by the given operation. This is the greater of two numbers: the bytes available, or the bytes already consumed
-