noob-se7en commented on code in PR #16572:
URL: https://github.com/apache/pinot/pull/16572#discussion_r2298664412


##########
pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/RealtimeConsumptionRateManager.java:
##########
@@ -88,25 +89,54 @@ public void enablePartitionRateLimiter() {
     _isThrottlingAllowed = true;
   }
 
+  public static class ServerRateLimitConfig {
+    private final double _serverRateLimit;
+    private final ThrottlingStrategy _throttlingStrategy;
+
+    ServerRateLimitConfig(double serverRateLimit,
+        RealtimeConsumptionRateManager.ThrottlingStrategy throttlingStrategy) {
+      _serverRateLimit = serverRateLimit;
+      _throttlingStrategy = throttlingStrategy;
+    }
+
+    @Override
+    public String toString() {
+      return "ServerRateLimitConfig{"
+          + "serverRateLimit=" + _serverRateLimit
+          + ", throttlingStrategy=" + _throttlingStrategy
+          + '}';
+    }
+  }
+
+  public static ServerRateLimitConfig resolveServerRateLimit(double 
messageRateLimit, double byteRateLimit) {
+    if (byteRateLimit > 0) {
+      return new ServerRateLimitConfig(byteRateLimit,
+          RealtimeConsumptionRateManager.ByteCountThrottlingStrategy.INSTANCE);
+    } else {
+      return new ServerRateLimitConfig(messageRateLimit,
+          
RealtimeConsumptionRateManager.MessageCountThrottlingStrategy.INSTANCE);
+    }
+  }
+
   public ConsumptionRateLimiter createServerRateLimiter(PinotConfiguration 
serverConfig, ServerMetrics serverMetrics) {
-    double serverRateLimit =
-        
serverConfig.getProperty(CommonConstants.Server.CONFIG_OF_SERVER_CONSUMPTION_RATE_LIMIT,
+    double messageRateLimit = 
serverConfig.getProperty(CommonConstants.Server.CONFIG_OF_SERVER_CONSUMPTION_RATE_LIMIT,

Review Comment:
   The user needs to set both the value for byte and message to < 0 for 
NOOP_RATE_LIMITER ?
   
   NOOP_RATE_LIMITER will be applied if 
   1. There is no rate limit config
   2. Both rate limit config have negative value
   3. If both rate limit config exists, we just pick byte rate limit config. 
and if thats negative then noop rate limiter gets applied.
   
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to