9aman commented on code in PR #16572:
URL: https://github.com/apache/pinot/pull/16572#discussion_r2284334299
##########
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:
This is different from what we do in
`public ConsumptionRateLimiter createServerRateLimiter`
If a user wants to switch from byte to number of messages consumed rate
limit, they might set the byte rate limit to 0 or a negative value.
While creation, this will work fine in createServerRateLimiter as we will
pick rate limit based on messages.
Here, we have taken a different approach while updating.
--
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]