pass to canAllocate (though nothing is done there now) the actual routing nodes
This commit is contained in:
parent
11dbbebb7a
commit
1ddd969fa7
|
@ -19,8 +19,6 @@
|
||||||
|
|
||||||
package org.elasticsearch.cluster.routing;
|
package org.elasticsearch.cluster.routing;
|
||||||
|
|
||||||
import org.elasticsearch.cluster.metadata.MetaData;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -119,7 +117,7 @@ public class RoutingNode implements Iterable<MutableShardRouting> {
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canAllocate(MetaData metaData, RoutingTable routingTable) {
|
public boolean canAllocate(RoutingNodes nodes) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -171,7 +171,7 @@ public class ShardsRoutingStrategy extends AbstractComponent {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lowRoutingNode.canAllocate(routingNodes.metaData(), routingNodes.routingTable()) && lowRoutingNode.canAllocate(startedShard)) {
|
if (lowRoutingNode.canAllocate(routingNodes) && lowRoutingNode.canAllocate(startedShard)) {
|
||||||
changed = true;
|
changed = true;
|
||||||
lowRoutingNode.add(new MutableShardRouting(startedShard.index(), startedShard.id(),
|
lowRoutingNode.add(new MutableShardRouting(startedShard.index(), startedShard.id(),
|
||||||
lowRoutingNode.nodeId(), startedShard.currentNodeId(),
|
lowRoutingNode.nodeId(), startedShard.currentNodeId(),
|
||||||
|
@ -245,7 +245,7 @@ public class ShardsRoutingStrategy extends AbstractComponent {
|
||||||
if (lastNode == nodes.size())
|
if (lastNode == nodes.size())
|
||||||
lastNode = 0;
|
lastNode = 0;
|
||||||
|
|
||||||
if (node.canAllocate(routingNodes.metaData(), routingNodes.routingTable()) && node.canAllocate(shard)) {
|
if (node.canAllocate(routingNodes) && node.canAllocate(shard)) {
|
||||||
int numberOfShardsToAllocate = routingNodes.requiredAverageNumberOfShardsPerNode() - node.shards().size();
|
int numberOfShardsToAllocate = routingNodes.requiredAverageNumberOfShardsPerNode() - node.shards().size();
|
||||||
if (numberOfShardsToAllocate == 0) {
|
if (numberOfShardsToAllocate == 0) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -271,7 +271,7 @@ public class ShardsRoutingStrategy extends AbstractComponent {
|
||||||
}
|
}
|
||||||
// go over the nodes and try and allocate the remaining ones
|
// go over the nodes and try and allocate the remaining ones
|
||||||
for (RoutingNode routingNode : routingNodes.nodesToShards().values()) {
|
for (RoutingNode routingNode : routingNodes.nodesToShards().values()) {
|
||||||
if (routingNode.canAllocate(routingNodes.metaData(), routingNodes.routingTable()) && routingNode.canAllocate(shard)) {
|
if (routingNode.canAllocate(routingNodes) && routingNode.canAllocate(shard)) {
|
||||||
changed = true;
|
changed = true;
|
||||||
routingNode.add(shard);
|
routingNode.add(shard);
|
||||||
it.remove();
|
it.remove();
|
||||||
|
@ -463,7 +463,7 @@ public class ShardsRoutingStrategy extends AbstractComponent {
|
||||||
List<RoutingNode> sortedNodesLeastToHigh = routingNodes.sortedNodesLeastToHigh();
|
List<RoutingNode> sortedNodesLeastToHigh = routingNodes.sortedNodesLeastToHigh();
|
||||||
for (RoutingNode target : sortedNodesLeastToHigh) {
|
for (RoutingNode target : sortedNodesLeastToHigh) {
|
||||||
if (target.canAllocate(failedShard) &&
|
if (target.canAllocate(failedShard) &&
|
||||||
target.canAllocate(routingNodes.metaData(), routingNodes.routingTable()) &&
|
target.canAllocate(routingNodes) &&
|
||||||
!target.nodeId().equals(failedShard.currentNodeId())) {
|
!target.nodeId().equals(failedShard.currentNodeId())) {
|
||||||
|
|
||||||
target.add(new MutableShardRouting(failedShard.index(), failedShard.id(),
|
target.add(new MutableShardRouting(failedShard.index(), failedShard.id(),
|
||||||
|
|
Loading…
Reference in New Issue