mirror of https://github.com/apache/druid.git
bug fix for autoscaling termination
This commit is contained in:
parent
fa733565e8
commit
26ed96f05d
|
@ -177,22 +177,19 @@ public class RemoteTaskRunner implements TaskRunner
|
|||
return;
|
||||
}
|
||||
|
||||
List<WorkerWrapper> thoseLazyWorkers = Lists.newArrayList(
|
||||
FunctionalIterable
|
||||
.create(zkWorkers.values())
|
||||
.filter(
|
||||
new Predicate<WorkerWrapper>()
|
||||
{
|
||||
@Override
|
||||
public boolean apply(WorkerWrapper input)
|
||||
{
|
||||
return input.getRunningTasks().isEmpty()
|
||||
&& System.currentTimeMillis() - input.getLastCompletedTaskTime().getMillis()
|
||||
> config.getMaxWorkerIdleTimeMillisBeforeDeletion();
|
||||
}
|
||||
}
|
||||
)
|
||||
);
|
||||
int workerCount = 0;
|
||||
List<WorkerWrapper> thoseLazyWorkers = Lists.newArrayList();
|
||||
for (WorkerWrapper workerWrapper : zkWorkers.values()) {
|
||||
workerCount++;
|
||||
|
||||
if (workerCount > workerSetupManager.getWorkerSetupData().getMinNumWorkers() &&
|
||||
workerWrapper.getRunningTasks().isEmpty() &&
|
||||
System.currentTimeMillis() - workerWrapper.getLastCompletedTaskTime().getMillis()
|
||||
> config.getMaxWorkerIdleTimeMillisBeforeDeletion()
|
||||
) {
|
||||
thoseLazyWorkers.add(workerWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
AutoScalingData terminated = strategy.terminate(
|
||||
Lists.transform(
|
||||
|
|
|
@ -38,7 +38,7 @@ public abstract class RemoteTaskRunnerConfig extends IndexerZkConfig
|
|||
public abstract DateTime getTerminateResourcesOriginDateTime();
|
||||
|
||||
@Config("druid.indexer.maxWorkerIdleTimeMillisBeforeDeletion")
|
||||
@Default("10000")
|
||||
@Default("600000")
|
||||
public abstract int getMaxWorkerIdleTimeMillisBeforeDeletion();
|
||||
|
||||
@Config("druid.indexer.maxScalingDuration")
|
||||
|
|
Loading…
Reference in New Issue