9aman commented on code in PR #16572:
URL: https://github.com/apache/pinot/pull/16572#discussion_r2284337453
##########
pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/ServerRateLimitConfigChangeListener.java:
##########
@@ -37,24 +37,35 @@ public ServerRateLimitConfigChangeListener(ServerMetrics
serverMetrics) {
@Override
public void onChange(Set<String> changedConfigs, Map<String, String>
clusterConfigs) {
- if
(!changedConfigs.contains(CommonConstants.Server.CONFIG_OF_SERVER_CONSUMPTION_RATE_LIMIT))
{
- LOGGER.info("ChangedConfigs: {} does not contain: {}. Skipping updates",
changedConfigs,
- CommonConstants.Server.CONFIG_OF_SERVER_CONSUMPTION_RATE_LIMIT);
+ if
(!changedConfigs.contains(CommonConstants.Server.CONFIG_OF_SERVER_CONSUMPTION_RATE_LIMIT)
+ &&
!changedConfigs.contains(CommonConstants.Server.CONFIG_OF_SERVER_CONSUMPTION_RATE_LIMIT_BYTES))
{
+ LOGGER.info("ChangedConfigs: {} does not contain: {} or {}. Skipping
updates", changedConfigs,
+ CommonConstants.Server.CONFIG_OF_SERVER_CONSUMPTION_RATE_LIMIT,
+
CommonConstants.Server.CONFIG_OF_SERVER_CONSUMPTION_RATE_LIMIT_BYTES);
return;
}
- // Init serverRateLimit as default rate limit in-case serverRateLimit
config is deleted/removed from cluster
- // configs.
- double serverRateLimit =
CommonConstants.Server.DEFAULT_SERVER_CONSUMPTION_RATE_LIMIT;
- if
(clusterConfigs.containsKey(CommonConstants.Server.CONFIG_OF_SERVER_CONSUMPTION_RATE_LIMIT))
{
- try {
- serverRateLimit =
-
Double.parseDouble(clusterConfigs.get(CommonConstants.Server.CONFIG_OF_SERVER_CONSUMPTION_RATE_LIMIT));
- } catch (NumberFormatException e) {
- LOGGER.error("Invalid rate limit config value: {}. Ignoring the config
change",
-
clusterConfigs.get(CommonConstants.Server.CONFIG_OF_SERVER_CONSUMPTION_RATE_LIMIT),
e);
- return;
- }
+
+ String configKey;
+ RealtimeConsumptionRateManager.ThrottlingStrategy throttlingStrategy;
+
+ if
(clusterConfigs.containsKey(CommonConstants.Server.CONFIG_OF_SERVER_CONSUMPTION_RATE_LIMIT_BYTES))
{
Review Comment:
The user might end up getting no rate limit
```
if (serverRateLimit <= 0) {
if (currentRateLimiter instanceof ServerRateLimiter) {
((ServerRateLimiter) currentRateLimiter).close();
_serverRateLimiter = NOOP_RATE_LIMITER;
// Note: The consumer threads already present before refer to the
serverRateLimiter object (not
// NOOP_RATE_LIMITER). These threads will keep calling throttle()
method and they might get blocked as a
// result of it, But the metric related to throttling won't be
emitted since as a result of here above the
// AsyncMetricEmitter will be closed. It's recommended to
forceCommit segments to avoid this.
}
return;
}
```
--
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]