Local Gateway: Possible failure to allocate shards to nodes when more than one index exists in the cluster (on full cluster restart), closes #409.
This commit is contained in:
parent
abf1855509
commit
31d94b19a1
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue