From acf371ef57ec749737a0cb198975738e769b9eca Mon Sep 17 00:00:00 2001 From: Simon Willnauer Date: Tue, 10 Dec 2013 10:41:43 +0100 Subject: [PATCH] Do not override thetas if sum is less or equals to `0` Closes #4390 --- .../routing/allocation/allocator/BalancedShardsAllocator.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/elasticsearch/cluster/routing/allocation/allocator/BalancedShardsAllocator.java b/src/main/java/org/elasticsearch/cluster/routing/allocation/allocator/BalancedShardsAllocator.java index d791fa8bb95..c6a96c3ee05 100644 --- a/src/main/java/org/elasticsearch/cluster/routing/allocation/allocator/BalancedShardsAllocator.java +++ b/src/main/java/org/elasticsearch/cluster/routing/allocation/allocator/BalancedShardsAllocator.java @@ -203,8 +203,9 @@ public class BalancedShardsAllocator extends AbstractComponent implements Shards sum = indexBalance + shardBalance; if (sum <= 0.0f) { thetaMap.put(operation, defaultTheta); + } else { + thetaMap.put(operation, new float[]{shardBalance / sum, indexBalance / sum, 0}); } - thetaMap.put(operation, new float[]{shardBalance / sum, indexBalance / sum, 0}); break; case BALANCE: case ALLOCATE: