@InterfaceAudience.Private @InterfaceStability.Evolving public class DefaultOperationQuota extends Object implements OperationQuota
OperationQuota.OperationType| Modifier and Type | Field and Description |
|---|---|
protected List<QuotaLimiter> |
limiters |
protected long |
readAvailable |
protected long |
readCapacityUnitConsumed |
protected long |
readCapacityUnitDiff |
protected long |
readConsumed |
protected long |
readDiff |
protected long |
writeCapacityUnitConsumed |
protected long |
writeCapacityUnitDiff |
protected long |
writeConsumed |
protected long |
writeDiff |
USE_RESULT_SIZE_BYTES, USE_RESULT_SIZE_BYTES_DEFAULT| Constructor and Description |
|---|
DefaultOperationQuota(org.apache.hadoop.conf.Configuration conf,
int blockSizeBytes,
QuotaLimiter... limiters) |
DefaultOperationQuota(org.apache.hadoop.conf.Configuration conf,
List<QuotaLimiter> limiters)
NOTE: The order matters.
|
| Modifier and Type | Method and Description |
|---|---|
void |
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 |
addScanResultCells(List<Cell> cells)
Add a scan result in the form of cells.
|
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 completion
|
long |
getReadAvailable()
Returns the number of bytes available to read to avoid exceeding the quota
|
long |
getReadConsumed()
Returns the number of bytes consumed from the quota by the operation
|
protected static long |
getScanReadConsumeEstimate(long blockSizeBytes,
long nextCallSeq,
long maxScannerResultSize,
long maxBlockBytesScanned,
long prevBlockBytesScannedDifference) |
protected void |
updateEstimateConsumeBatchQuota(int numWrites,
int numReads)
Update estimate quota(read/write size/capacityUnits) which will be consumed
|
protected void |
updateEstimateConsumeScanQuota(org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.ScanRequest scanRequest,
long maxScannerResultSize,
long maxBlockBytesScanned,
long prevBlockBytesScannedDifference)
Update estimate quota(read/write size/capacityUnits) which will be consumed
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetMaxResultSizeprotected final List<QuotaLimiter> limiters
protected long readAvailable
protected long writeConsumed
protected long readConsumed
protected long writeCapacityUnitConsumed
protected long readCapacityUnitConsumed
protected long writeDiff
protected long readDiff
protected long writeCapacityUnitDiff
protected long readCapacityUnitDiff
public DefaultOperationQuota(org.apache.hadoop.conf.Configuration conf,
int blockSizeBytes,
QuotaLimiter... limiters)
public DefaultOperationQuota(org.apache.hadoop.conf.Configuration conf,
List<QuotaLimiter> limiters)
public void checkBatchQuota(int numWrites,
int numReads)
throws RpcThrottlingException
OperationQuotacheckBatchQuota in interface OperationQuotanumWrites - number of write operation that will be performednumReads - number of small-read operation that will be performedRpcThrottlingException - if the operation cannot be performed because RPC quota is
exceeded.public void checkScanQuota(org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.ScanRequest scanRequest, long maxScannerResultSize, long maxBlockBytesScanned, long prevBlockBytesScannedDifference) throws RpcThrottlingException
OperationQuotacheckScanQuota in interface OperationQuotascanRequest - 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
callsRpcThrottlingException - if the operation cannot be performed because RPC quota is
exceeded.public void close()
OperationQuotaclose in interface OperationQuotapublic long getReadAvailable()
OperationQuotagetReadAvailable in interface OperationQuotapublic long getReadConsumed()
OperationQuotagetReadConsumed in interface OperationQuotapublic void addGetResult(Result result)
OperationQuotaaddGetResult in interface OperationQuotapublic void addScanResult(List<Result> results)
OperationQuotaaddScanResult in interface OperationQuotapublic void addScanResultCells(List<Cell> cells)
OperationQuotaaddScanResultCells in interface OperationQuotapublic void addMutation(Mutation mutation)
OperationQuotaaddMutation in interface OperationQuotaprotected void updateEstimateConsumeBatchQuota(int numWrites,
int numReads)
numWrites - the number of write requestsnumReads - the number of read requestsprotected void updateEstimateConsumeScanQuota(org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.ScanRequest scanRequest, long maxScannerResultSize, long maxBlockBytesScanned, long prevBlockBytesScannedDifference)
scanRequest - the scan to be executedmaxScannerResultSize - 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
callsprotected static long getScanReadConsumeEstimate(long blockSizeBytes,
long nextCallSeq,
long maxScannerResultSize,
long maxBlockBytesScanned,
long prevBlockBytesScannedDifference)
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.