renamve var to better reflect its state (started, not active)
This commit is contained in:
parent
3117341f44
commit
11dbbebb7a
|
@ -156,10 +156,10 @@ public class ShardsRoutingStrategy extends AbstractComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean relocated = false;
|
boolean relocated = false;
|
||||||
List<MutableShardRouting> activeShards = highRoutingNode.shardsWithState(STARTED);
|
List<MutableShardRouting> startedShards = highRoutingNode.shardsWithState(STARTED);
|
||||||
for (MutableShardRouting activeShard : activeShards) {
|
for (MutableShardRouting startedShard : startedShards) {
|
||||||
// we only relocate shards that all other shards within the replication group are active
|
// we only relocate shards that all other shards within the replication group are active
|
||||||
List<MutableShardRouting> allShards = routingNodes.shardsRoutingFor(activeShard);
|
List<MutableShardRouting> allShards = routingNodes.shardsRoutingFor(startedShard);
|
||||||
boolean ignoreShard = false;
|
boolean ignoreShard = false;
|
||||||
for (MutableShardRouting allShard : allShards) {
|
for (MutableShardRouting allShard : allShards) {
|
||||||
if (!allShard.active()) {
|
if (!allShard.active()) {
|
||||||
|
@ -171,13 +171,13 @@ public class ShardsRoutingStrategy extends AbstractComponent {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lowRoutingNode.canAllocate(routingNodes.metaData(), routingNodes.routingTable()) && lowRoutingNode.canAllocate(activeShard)) {
|
if (lowRoutingNode.canAllocate(routingNodes.metaData(), routingNodes.routingTable()) && lowRoutingNode.canAllocate(startedShard)) {
|
||||||
changed = true;
|
changed = true;
|
||||||
lowRoutingNode.add(new MutableShardRouting(activeShard.index(), activeShard.id(),
|
lowRoutingNode.add(new MutableShardRouting(startedShard.index(), startedShard.id(),
|
||||||
lowRoutingNode.nodeId(), activeShard.currentNodeId(),
|
lowRoutingNode.nodeId(), startedShard.currentNodeId(),
|
||||||
activeShard.primary(), INITIALIZING));
|
startedShard.primary(), INITIALIZING));
|
||||||
|
|
||||||
activeShard.relocate(lowRoutingNode.nodeId());
|
startedShard.relocate(lowRoutingNode.nodeId());
|
||||||
relocated = true;
|
relocated = true;
|
||||||
relocationPerformed = true;
|
relocationPerformed = true;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue