himanshug commented on a change in pull request #9350: Overlord to support
autoscalers per indexer/middlemanager category
URL: https://github.com/apache/druid/pull/9350#discussion_r387864052
##########
File path:
indexing-service/src/main/java/org/apache/druid/indexing/overlord/autoscaling/PendingTaskBasedWorkerProvisioningStrategy.java
##########
@@ -408,18 +521,50 @@ public String apply(Worker zkWorker)
return didTerminate;
}
+ private boolean initAutoscalers(DefaultWorkerBehaviorConfig workerConfig)
+ {
+ boolean didProvision = false;
+ for (AutoScaler autoScaler : workerConfig.getAutoScalers()) {
+ String category = ProvisioningUtil.getAutoscalerCategory(autoScaler);
+ didProvision = initAutoscaler(autoScaler, category, workerConfig,
currentlyProvisioningMap) || didProvision;
+ }
+ return didProvision;
+ }
+
+ private boolean initAutoscaler(
+ AutoScaler autoScaler,
+ String category,
+ DefaultWorkerBehaviorConfig workerConfig,
+ Map<String, Set<String>> currentlyProvisioningMap
+ )
+ {
+ currentlyProvisioningMap.putIfAbsent(
+ category,
+ new HashSet<>()
+ );
+ Set<String> currentlyProvisioning =
currentlyProvisioningMap.get(category);
Review comment:
nit: following replacement avoids instantiation of a new HashSet object on
each call to this method.
```suggestion
Set<String> currentlyProvisioning =
currentlyProvisioningMap.computeIfAbsent(
category,
ignored -> new HashSet<>()
);
```
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]