You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by jl...@apache.org on 2021/09/23 16:52:23 UTC

[pinot] branch master updated: Fix missing rate limiter if brokerResourceEV becomes null due to ZK connection (#7470)

This is an automated email from the ASF dual-hosted git repository.

jlli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new b2bac68  Fix missing rate limiter if brokerResourceEV becomes null due to ZK connection (#7470)
b2bac68 is described below

commit b2bac682ac43e435b4258c67a19010089f4f49aa
Author: Jialiang Li <jl...@linkedin.com>
AuthorDate: Thu Sep 23 09:52:10 2021 -0700

    Fix missing rate limiter if brokerResourceEV becomes null due to ZK connection (#7470)
    
    Co-authored-by: Jack Li(Analytics Engineering) <jl...@jlli-mn1.linkedin.biz>
---
 .../HelixExternalViewBasedQueryQuotaManager.java          | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/pinot-broker/src/main/java/org/apache/pinot/broker/queryquota/HelixExternalViewBasedQueryQuotaManager.java b/pinot-broker/src/main/java/org/apache/pinot/broker/queryquota/HelixExternalViewBasedQueryQuotaManager.java
index 216f827..67df9c6 100644
--- a/pinot-broker/src/main/java/org/apache/pinot/broker/queryquota/HelixExternalViewBasedQueryQuotaManager.java
+++ b/pinot-broker/src/main/java/org/apache/pinot/broker/queryquota/HelixExternalViewBasedQueryQuotaManager.java
@@ -164,7 +164,8 @@ public class HelixExternalViewBasedQueryQuotaManager implements ClusterChangeHan
 
     if (brokerResource == null) {
       LOGGER.warn("Failed to init qps quota for table {}. No broker resource connected!", tableNameWithType);
-      buildEmptyOrResetRateLimiterInQueryQuotaEntity(tableNameWithType);
+      // It could be possible that brokerResourceEV is null due to ZK connection issue.
+      // In this case, the rate limiter should not be reset. Simply exit the method would be sufficient.
       return;
     }
 
@@ -204,21 +205,23 @@ public class HelixExternalViewBasedQueryQuotaManager implements ClusterChangeHan
           onlineCount, stat.getVersion());
     } else {
       RateLimiter rateLimiter = queryQuotaEntity.getRateLimiter();
+      double previousRate = -1;
       if (rateLimiter == null) {
         // Query quota is just added to the table.
         rateLimiter = RateLimiter.create(perBrokerRate);
         queryQuotaEntity.setRateLimiter(rateLimiter);
       } else {
         // Query quota gets updated to a new value.
+        previousRate = rateLimiter.getRate();
         rateLimiter.setRate(perBrokerRate);
       }
       queryQuotaEntity.setNumOnlineBrokers(onlineCount);
       queryQuotaEntity.setOverallRate(overallRate);
       queryQuotaEntity.setTableConfigStatVersion(stat.getVersion());
       LOGGER.info(
-          "Rate limiter for table: {} has been updated. Overall rate: {}. Per-broker rate: {}. Number of online "
-              + "broker instances: {}. Table config stat version: {}", tableNameWithType, overallRate, perBrokerRate,
-          onlineCount, stat.getVersion());
+          "Rate limiter for table: {} has been updated. Overall rate: {}. Previous per-broker rate: {}. New "
+              + "per-broker rate: {}. Number of online broker instances: {}. Table config stat version: {}",
+          tableNameWithType, overallRate, previousRate, perBrokerRate, onlineCount, stat.getVersion());
     }
     addMaxBurstQPSCallbackTableGaugeIfNeeded(tableNameWithType, queryQuotaEntity);
     if (isQueryRateLimitDisabled()) {
@@ -424,8 +427,8 @@ public class HelixExternalViewBasedQueryQuotaManager implements ClusterChangeHan
         queryQuotaEntity.setOverallRate(overallRate);
         queryQuotaEntity.setTableConfigStatVersion(stat.getVersion());
         LOGGER.info("Rate limiter for table: {} has been updated. Overall rate: {}. Previous per-broker rate: {}. New "
-                + "per-broker rate: {}. Number of online broker instances: {}", tableNameWithType, overallRate,
-            previousRate, latestRate, onlineBrokerCount);
+                + "per-broker rate: {}. Number of online broker instances: {}. Table config stat version: {}.",
+            tableNameWithType, overallRate, previousRate, latestRate, onlineBrokerCount, stat.getVersion());
         numRebuilt++;
       }
     }

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org