From 48511e15cf6f06906b42238493cde978c1180800 Mon Sep 17 00:00:00 2001 From: Gian Merlino Date: Mon, 2 Jun 2014 12:34:54 -0700 Subject: [PATCH] Autoscaling: Fix case where target < current, but target is too low. This can happen when workers are provisioned manually. --- .../scaling/SimpleResourceManagementStrategy.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/indexing-service/src/main/java/io/druid/indexing/overlord/scaling/SimpleResourceManagementStrategy.java b/indexing-service/src/main/java/io/druid/indexing/overlord/scaling/SimpleResourceManagementStrategy.java index fa7e987e7d3..6d3dd904c5e 100644 --- a/indexing-service/src/main/java/io/druid/indexing/overlord/scaling/SimpleResourceManagementStrategy.java +++ b/indexing-service/src/main/java/io/druid/indexing/overlord/scaling/SimpleResourceManagementStrategy.java @@ -323,14 +323,15 @@ public class SimpleResourceManagementStrategy implements ResourceManagementStrat ); } - final boolean atSteadyState = currentlyProvisioning.isEmpty() - && currentlyTerminating.isEmpty() - && validWorkers.size() == targetWorkerCount; - final boolean shouldScaleUp = atSteadyState + final boolean notTakingActions = currentlyProvisioning.isEmpty() + && currentlyTerminating.isEmpty(); + final boolean shouldScaleUp = notTakingActions + && validWorkers.size() >= targetWorkerCount && targetWorkerCount < maxWorkerCount && (hasTaskPendingBeyondThreshold(pendingTasks) || targetWorkerCount < minWorkerCount); - final boolean shouldScaleDown = atSteadyState + final boolean shouldScaleDown = notTakingActions + && validWorkers.size() == targetWorkerCount && targetWorkerCount > minWorkerCount && Iterables.any(validWorkers, isLazyWorker); if (shouldScaleUp) {