zhangyue19921010 commented on a change in pull request #10524:
URL: https://github.com/apache/druid/pull/10524#discussion_r570004346
##########
File path:
indexing-service/src/main/java/org/apache/druid/indexing/seekablestream/supervisor/SeekableStreamSupervisorSpec.java
##########
@@ -151,6 +156,29 @@ public DruidMonitorSchedulerConfig
getMonitorSchedulerConfig()
@Override
public abstract Supervisor createSupervisor();
+ /**
+ * need to notice that autoScaler would be null which means autoscale is
dissable.
+ * @param supervisor
+ * @return autoScaler, disable autoscale will return dummyAutoScaler and
enable autoscale wiil return defaultAutoScaler by default.
+ */
+ @Override
+ @SuppressFBWarnings(value = "RV_RETURN_VALUE_IGNORED", justification =
"using siwtch(String)")
+ public SupervisorTaskAutoscaler createAutoscaler(Supervisor supervisor)
+ {
+ String dataSource = getId();
+ SupervisorTaskAutoscaler autoScaler = new DummyAutoScaler(supervisor,
dataSource);
+ Map<String, Object> dynamicAllocationTasksProperties =
ingestionSchema.getIOConfig().getDynamicAllocationTasksProperties();
+ if (dynamicAllocationTasksProperties != null &&
!dynamicAllocationTasksProperties.isEmpty() &&
Boolean.parseBoolean(String.valueOf(dynamicAllocationTasksProperties.getOrDefault("enableDynamicAllocationTasks",
false)))) {
+ String autoScalerStrategy =
String.valueOf(dynamicAllocationTasksProperties.getOrDefault("autoScalerStrategy",
"default"));
+
+ // will thorw 'Return value of String.hashCode() ignored :
RV_RETURN_VALUE_IGNORED' just Suppress it.
+ switch (StringUtils.toLowerCase(autoScalerStrategy)) {
+ default: autoScaler = new DefaultAutoScaler(supervisor, dataSource,
dynamicAllocationTasksProperties, this);
+ }
Review comment:
Nice catch! I modified the way of obtaining configurations using
Jackson like I mentioned above.
In this way, Users can not only defined their own scale algorithms, but also
can build corresponding configuration.
Also it is easier to ensure consistency of default values. Also we don't
need to do map.get/parse work anymore.
As`supervisor` is newed in Druid everywhere. It is necessary to create the
autoscaler which hold `supervisor` instance using jackson? 🤕
----------------------------------------------------------------
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]