Class HelixExternalViewBasedQueryQuotaManager

    • Constructor Detail

      • HelixExternalViewBasedQueryQuotaManager

        public HelixExternalViewBasedQueryQuotaManager​(org.apache.pinot.common.metrics.BrokerMetrics brokerMetrics,
                                                       String instanceId)
    • Method Detail

      • init

        public void init​(org.apache.helix.HelixManager helixManager)
        Description copied from interface: ClusterChangeHandler
        Initializes the cluster change handler with the given connected Helix manager.
        Specified by:
        init in interface ClusterChangeHandler
      • processClusterChange

        public void processClusterChange​(org.apache.helix.HelixConstants.ChangeType changeType)
        Description copied from interface: ClusterChangeHandler
        Processes the cluster change of the given type (e.g. EXTERNAL_VIEW, INSTANCE_CONFIG, LIVE_INSTANCE).
        Specified by:
        processClusterChange in interface ClusterChangeHandler
      • initOrUpdateTableQueryQuota

        public void initOrUpdateTableQueryQuota​(String tableNameWithType)
      • initOrUpdateTableQueryQuota

        public void initOrUpdateTableQueryQuota​(org.apache.pinot.spi.config.table.TableConfig tableConfig,
                                                org.apache.helix.model.ExternalView brokerResourceEV)
        Initialize or update dynamic rate limiter with table query quota.
        Parameters:
        tableConfig - table config.
        brokerResourceEV - broker resource which stores all the broker states of each table.
      • dropTableQueryQuota

        public void dropTableQueryQuota​(String tableNameWithType)
        Drop table query quota.
        Parameters:
        tableNameWithType - table name with type.
      • acquire

        public boolean acquire​(String tableName)
        Try to acquire a quota for the given table.

        Acquires a token from rate limiter based on the table name.

        Specified by:
        acquire in interface QueryQuotaManager
        Parameters:
        tableName - Table name with or without type suffix
        Returns:
        true if there is no query quota specified for the table or a token can be acquired, otherwise return false.
      • getRateLimiterMapSize

        public int getRateLimiterMapSize()
      • cleanUpRateLimiterMap

        public void cleanUpRateLimiterMap()
      • processQueryRateLimitingExternalViewChange

        public void processQueryRateLimitingExternalViewChange​(org.apache.helix.model.ExternalView currentBrokerResourceEV)
        Process query quota change when number of online brokers has changed.
      • processQueryRateLimitingInstanceConfigChange

        public void processQueryRateLimitingInstanceConfigChange()
        Process query quota state change when instance config gets changed
      • isQueryRateLimitDisabled

        public boolean isQueryRateLimitDisabled()