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 Details

  • Constructor Details

  • Method Details

    • start

      public void start(RpcScheduler rpcScheduler) throws IOException
      Throws:
      IOException
    • stop

      public void stop()
    • isRpcThrottleEnabled

      protected boolean isRpcThrottleEnabled()
    • isQuotaEnabled

      private boolean isQuotaEnabled()
    • switchRpcThrottle

      public void switchRpcThrottle(boolean enable) throws IOException
      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 operation
      table - 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 interface RpcQuotaManager
      Parameters:
      region - the region where the operation will be performed
      scanRequest - the scan to be estimated against the quota
      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
      Returns:
      the OperationQuota
      Throws:
      RpcThrottlingException - if the operation cannot be executed due to quota exceeded.
      IOException
    • checkBatchQuota

      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 interface RpcQuotaManager
      Parameters:
      region - the region where the operation will be performed
      type - 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 interface RpcQuotaManager
      Parameters:
      region - the region where the operation will be performed
      actions - the "multi" actions to perform
      hasCondition - 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 interface RpcQuotaManager
      Parameters:
      region - the region where the operation will be performed
      numWrites - number of writes to perform
      numReads - 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