Interface OperationQuota

All Known Implementing Classes:
DefaultOperationQuota, ExceedOperationQuota, NoopOperationQuota

@Private @Evolving public interface OperationQuota
Interface that allows to check the quota available for an operation.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static enum 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static 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 Type
    Method
    Description
    void
    Add a get result.
    void
    Add a mutation result.
    void
    Add a scan result.
    void
    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
    Cleanup method on operation completion
    default 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 quota
    long
    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

      static final boolean USE_RESULT_SIZE_BYTES_DEFAULT
      See Also:
  • Method Details

    • checkBatchQuota

      void checkBatchQuota(int numWrites, int numReads) throws RpcThrottlingException
      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 performed
      numReads - 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 operation
      maxScannerResultSize - the maximum bytes to be returned by the scanner
      maxBlockBytesScanned - the maximum bytes scanned in a single RPC call by the scanner
      prevBlockBytesScannedDifference - 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

      void addGetResult(Result result)
      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

      void addScanResult(List<Result> results)
      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.
    • addScanResultCells

      Add a scan result in the form of cells. This will be used to calculate the exact quota and have a better long-read average size for the next time.
    • addMutation

      void addMutation(Mutation mutation)
      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

      Returns the number of bytes available to read to avoid exceeding the quota
    • getReadConsumed

      Returns the number of bytes consumed from the quota by the operation
    • getMaxResultSize

      default long 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