Skip to content

Commit

Permalink
Local Gateway: Possible failure to allocate shards to nodes when more…
Browse files Browse the repository at this point in the history
… than one index exists in the cluster (on full cluster restart), closes #409.
  • Loading branch information
kimchy committed Oct 5, 2010
1 parent abf1855 commit 31d94b1
Showing 1 changed file with 9 additions and 7 deletions.
Expand Up @@ -224,15 +224,17 @@ public class LocalGatewayNodeAllocation extends NodeAllocation {

if (allocate) {
changed = true;
// we found all nodes to allocate to, do the allocation
// we found all nodes to allocate to, do the allocation (but only for the index we are working on)
for (Iterator<MutableShardRouting> it = routingNodes.unassigned().iterator(); it.hasNext();) {
MutableShardRouting shardRouting = it.next();
if (shardRouting.primary()) {
DiscoveryNode node = shards.get(shardRouting.shardId()).v1();
logger.debug("[{}][{}] initial allocation to [{}]", shardRouting.index(), shardRouting.id(), node);
RoutingNode routingNode = routingNodes.node(node.id());
routingNode.add(shardRouting);
it.remove();
if (shardRouting.index().equals(indexRoutingTable.index())) {
if (shardRouting.primary()) {
DiscoveryNode node = shards.get(shardRouting.shardId()).v1();
logger.debug("[{}][{}] initial allocation to [{}]", shardRouting.index(), shardRouting.id(), node);
RoutingNode routingNode = routingNodes.node(node.id());
routingNode.add(shardRouting);
it.remove();
}
}
}
} else {
Expand Down

0 comments on commit 31d94b1

Please sign in to comment.