Cluster Allocation: cluster.routing.allocation.allow_rebalance does not allow for rebalancing on relocating shard, closes #1651.

This commit is contained in:
Shay Banon 2012-01-30 01:58:51 +02:00
parent 70c334ec01
commit f6deb45970
3 changed files with 3 additions and 5 deletions

View File

@ -67,7 +67,7 @@ public class ClusterRebalanceAllocationDecider extends AllocationDecider {
List<MutableShardRouting> shards = node.shards();
for (int i = 0; i < shards.size(); i++) {
MutableShardRouting shard = shards.get(i);
if (shard.primary() && !shard.active()) {
if (shard.primary() && !shard.active() && shard.relocatingNodeId() == null) {
return false;
}
}
@ -82,7 +82,7 @@ public class ClusterRebalanceAllocationDecider extends AllocationDecider {
List<MutableShardRouting> shards = node.shards();
for (int i = 0; i < shards.size(); i++) {
MutableShardRouting shard = shards.get(i);
if (!shard.active()) {
if (!shard.active() && shard.relocatingNodeId() == null) {
return false;
}
}

View File

@ -35,8 +35,8 @@ import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
import static org.elasticsearch.cluster.routing.RoutingBuilders.indexRoutingTable;
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.*;
import static org.elasticsearch.test.unit.cluster.routing.allocation.RoutingAllocationTests.newNode;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
import static org.elasticsearch.test.unit.cluster.routing.allocation.RoutingAllocationTests.newNode;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.nullValue;
@ -50,7 +50,6 @@ public class ConcurrentRebalanceRoutingTests {
public void testClusterConcurrentRebalance() {
AllocationService strategy = new AllocationService(settingsBuilder()
.put("cluster.routing.allocation.concurrent_recoveries", 10)
.put("cluster.routing.allocation.allow_rebalance", "always")
.put("cluster.routing.allocation.cluster_concurrent_rebalance", 3)
.build());

View File

@ -100,7 +100,6 @@ public class ShardsLimitAllocationTests {
AllocationService strategy = new AllocationService(settingsBuilder()
.put("cluster.routing.allocation.concurrent_recoveries", 10)
.put("cluster.routing.allocation.node_initial_primaries_recoveries", 10)
.put("cluster.routing.allocation.allow_rebalance", "always")
.put("cluster.routing.allocation.cluster_concurrent_rebalance", -1)
.build());