rollback commit, allocation should only happen when index is not recovered
This commit is contained in:
parent
9a09261383
commit
69ecf8b66b
|
@ -154,8 +154,11 @@ public class LocalGatewayNodeAllocation extends NodeAllocation {
|
||||||
RoutingNodes routingNodes = allocation.routingNodes();
|
RoutingNodes routingNodes = allocation.routingNodes();
|
||||||
|
|
||||||
for (IndexRoutingTable indexRoutingTable : routingNodes.routingTable()) {
|
for (IndexRoutingTable indexRoutingTable : routingNodes.routingTable()) {
|
||||||
// TODO we need to also handle a case where all shards per replication group are unassigned, in that case, we ignore until we
|
// only do the allocation if there is a local "INDEX NOT RECOVERED" block
|
||||||
// manage to find a place to allocate them...
|
if (!routingNodes.blocks().hasIndexBlock(indexRoutingTable.index(), LocalGateway.INDEX_NOT_RECOVERED_BLOCK)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (indexRoutingTable.allPrimaryShardsUnassigned()) {
|
if (indexRoutingTable.allPrimaryShardsUnassigned()) {
|
||||||
// all primary are unassigned for the index, see if we can allocate it on existing nodes, if not, don't assign
|
// all primary are unassigned for the index, see if we can allocate it on existing nodes, if not, don't assign
|
||||||
Set<String> nodesIds = Sets.newHashSet();
|
Set<String> nodesIds = Sets.newHashSet();
|
||||||
|
@ -245,7 +248,6 @@ public class LocalGatewayNodeAllocation extends NodeAllocation {
|
||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
// go ahead and see if we can optimize replica allocation to an existing node...
|
|
||||||
Iterator<MutableShardRouting> unassignedIterator = routingNodes.unassigned().iterator();
|
Iterator<MutableShardRouting> unassignedIterator = routingNodes.unassigned().iterator();
|
||||||
while (unassignedIterator.hasNext()) {
|
while (unassignedIterator.hasNext()) {
|
||||||
MutableShardRouting shard = unassignedIterator.next();
|
MutableShardRouting shard = unassignedIterator.next();
|
||||||
|
|
Loading…
Reference in New Issue