From caa6495e2b77124ef2d6e78321fe82fd5e33bae3 Mon Sep 17 00:00:00 2001 From: kimchy Date: Sun, 17 Oct 2010 01:52:23 +0200 Subject: [PATCH] doc --- .../gateway/local/LocalGatewayNodeAllocation.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/gateway/local/LocalGatewayNodeAllocation.java b/modules/elasticsearch/src/main/java/org/elasticsearch/gateway/local/LocalGatewayNodeAllocation.java index aedadad0952..3f58a501439 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/gateway/local/LocalGatewayNodeAllocation.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/gateway/local/LocalGatewayNodeAllocation.java @@ -154,11 +154,8 @@ public class LocalGatewayNodeAllocation extends NodeAllocation { RoutingNodes routingNodes = allocation.routingNodes(); for (IndexRoutingTable indexRoutingTable : routingNodes.routingTable()) { - // only do the allocation if there is a local "INDEX NOT RECOVERED" block - if (!routingNodes.blocks().hasIndexBlock(indexRoutingTable.index(), LocalGateway.INDEX_NOT_RECOVERED_BLOCK)) { - continue; - } - + // TODO we need to also handle a case where all shards per replication group are unassigned, in that case, we ignore until we + // manage to find a place to allocate them... if (indexRoutingTable.allPrimaryShardsUnassigned()) { // all primary are unassigned for the index, see if we can allocate it on existing nodes, if not, don't assign Set nodesIds = Sets.newHashSet(); @@ -248,6 +245,7 @@ public class LocalGatewayNodeAllocation extends NodeAllocation { return changed; } + // go ahead and see if we can optimize replica allocation to an existing node... Iterator unassignedIterator = routingNodes.unassigned().iterator(); while (unassignedIterator.hasNext()) { MutableShardRouting shard = unassignedIterator.next();