@InterfaceAudience.Private @InterfaceStability.Evolving public class DefaultOperationQuota extends Object implements OperationQuota
OperationQuota.OperationType
Modifier and Type | Field and Description |
---|---|
protected List<QuotaLimiter> |
limiters |
private static org.slf4j.Logger |
LOG |
private long[] |
operationSize |
protected long |
readAvailable |
private long |
readCapacityUnit |
protected long |
readCapacityUnitConsumed |
protected long |
readCapacityUnitDiff |
protected long |
readConsumed |
protected long |
readDiff |
protected long |
writeAvailable |
private long |
writeCapacityUnit |
protected long |
writeCapacityUnitConsumed |
protected long |
writeCapacityUnitDiff |
protected long |
writeConsumed |
protected long |
writeDiff |
Constructor and Description |
---|
DefaultOperationQuota(org.apache.hadoop.conf.Configuration conf,
List<QuotaLimiter> limiters)
NOTE: The order matters.
|
DefaultOperationQuota(org.apache.hadoop.conf.Configuration conf,
QuotaLimiter... limiters) |
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.
|
private long |
calculateReadCapacityUnit(long size) |
private long |
calculateReadCapacityUnitDiff(long actualSize,
long estimateSize) |
private long |
calculateWriteCapacityUnit(long size) |
private long |
calculateWriteCapacityUnitDiff(long actualSize,
long estimateSize) |
void |
checkQuota(int numWrites,
int numReads,
int numScans)
Checks if it is possible to execute the specified operation.
|
void |
close()
Cleanup method on operation completion
|
private long |
estimateConsume(OperationQuota.OperationType type,
int numReqs,
long avgSize) |
long |
getReadAvailable() |
long |
getWriteAvailable() |
protected void |
updateEstimateConsumeQuota(int numWrites,
int numReads,
int numScans)
Update estimate quota(read/write size/capacityUnits) which will be consumed
|
private static final org.slf4j.Logger LOG
protected final List<QuotaLimiter> limiters
private final long writeCapacityUnit
private final long readCapacityUnit
protected long writeAvailable
protected long readAvailable
protected long writeConsumed
protected long readConsumed
protected long writeCapacityUnitConsumed
protected long readCapacityUnitConsumed
private final long[] operationSize
protected long writeDiff
protected long readDiff
protected long writeCapacityUnitDiff
protected long readCapacityUnitDiff
public DefaultOperationQuota(org.apache.hadoop.conf.Configuration conf, QuotaLimiter... limiters)
public DefaultOperationQuota(org.apache.hadoop.conf.Configuration conf, List<QuotaLimiter> limiters)
public void checkQuota(int numWrites, int numReads, int numScans) throws RpcThrottlingException
OperationQuota
checkQuota
in interface OperationQuota
numWrites
- number of write operation that will be performednumReads
- number of small-read operation that will be performednumScans
- number of long-read operation that will be performedRpcThrottlingException
- if the operation cannot be performed because
RPC quota is exceeded.public void close()
OperationQuota
close
in interface OperationQuota
public long getReadAvailable()
getReadAvailable
in interface OperationQuota
public long getWriteAvailable()
getWriteAvailable
in interface OperationQuota
public void addGetResult(Result result)
OperationQuota
addGetResult
in interface OperationQuota
public void addScanResult(List<Result> results)
OperationQuota
addScanResult
in interface OperationQuota
public void addMutation(Mutation mutation)
OperationQuota
addMutation
in interface OperationQuota
protected void updateEstimateConsumeQuota(int numWrites, int numReads, int numScans)
numWrites
- the number of write requestsnumReads
- the number of read requestsnumScans
- the number of scan requestsprivate long estimateConsume(OperationQuota.OperationType type, int numReqs, long avgSize)
private long calculateWriteCapacityUnit(long size)
private long calculateReadCapacityUnit(long size)
private long calculateWriteCapacityUnitDiff(long actualSize, long estimateSize)
private long calculateReadCapacityUnitDiff(long actualSize, long estimateSize)
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.