From 2865ceef85011c42b03356e6e1b45994d80f370e Mon Sep 17 00:00:00 2001 From: kimchy Date: Sat, 21 Aug 2010 19:55:38 +0300 Subject: [PATCH] more on sorted nodes when allocating shards above average number of shards per node --- .../cluster/routing/strategy/ShardsRoutingStrategy.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/routing/strategy/ShardsRoutingStrategy.java b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/routing/strategy/ShardsRoutingStrategy.java index a7d39ae686a..808b67f905f 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/routing/strategy/ShardsRoutingStrategy.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/routing/strategy/ShardsRoutingStrategy.java @@ -270,7 +270,7 @@ public class ShardsRoutingStrategy extends AbstractComponent { } } // go over the nodes and try and allocate the remaining ones - for (RoutingNode routingNode : routingNodes.nodesToShards().values()) { + for (RoutingNode routingNode : routingNodes.sortedNodesLeastToHigh()) { if (routingNode.canAllocate(routingNodes) && routingNode.canAllocate(shard)) { changed = true; routingNode.add(shard);