9aman commented on code in PR #16572:
URL: https://github.com/apache/pinot/pull/16572#discussion_r2297383943


##########
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:
   Please correct me if I am wrong here. 
   The user needs to set both the value for byte and message to < 0 for 
NOOP_RATE_LIMITER ?
   I guess previously we only need to set message rate limit to < 0 and by 
default we always rate limit. 



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