diff --git a/server/src/main/java/org/elasticsearch/cluster/routing/allocation/allocator/DesiredBalanceComputer.java b/server/src/main/java/org/elasticsearch/cluster/routing/allocation/allocator/DesiredBalanceComputer.java index 44794b70a41b9..42240a996c531 100644 --- a/server/src/main/java/org/elasticsearch/cluster/routing/allocation/allocator/DesiredBalanceComputer.java +++ b/server/src/main/java/org/elasticsearch/cluster/routing/allocation/allocator/DesiredBalanceComputer.java @@ -335,7 +335,7 @@ public DesiredBalance compute( nextReportTime = currentTime + timeWarningInterval; } - if (hasComputationConverged(hasChanges, i)) { + if (hasChanges == false && hasEnoughIterations(i)) { logger.debug( "Desired balance computation for [{}] converged after [{}] and [{}] iterations", desiredBalanceInput.index(), @@ -415,8 +415,8 @@ public DesiredBalance compute( } // visible for testing - boolean hasComputationConverged(boolean hasRoutingChanges, int currentIteration) { - return hasRoutingChanges == false; + boolean hasEnoughIterations(int currentIteration) { + return true; } private static Map collectShardAssignments(RoutingNodes routingNodes) { diff --git a/server/src/test/java/org/elasticsearch/cluster/routing/allocation/allocator/DesiredBalanceShardsAllocatorTests.java b/server/src/test/java/org/elasticsearch/cluster/routing/allocation/allocator/DesiredBalanceShardsAllocatorTests.java index cd0d1e8a180dd..27c430131ff07 100644 --- a/server/src/test/java/org/elasticsearch/cluster/routing/allocation/allocator/DesiredBalanceShardsAllocatorTests.java +++ b/server/src/test/java/org/elasticsearch/cluster/routing/allocation/allocator/DesiredBalanceShardsAllocatorTests.java @@ -408,8 +408,8 @@ public DesiredBalance compute( } @Override - boolean hasComputationConverged(boolean hasRoutingChanges, int currentIteration) { - return super.hasComputationConverged(hasRoutingChanges, currentIteration) && currentIteration >= minIterations; + boolean hasEnoughIterations(int currentIteration) { + return currentIteration >= minIterations; } }, reconcileAction,