Disable allocation: New indices allocation not to be disabled by default

When setting cluster.routing.allocation.disable_allocation, it causes new indices primary shards to not be allocated. By default, new indices created should allow to, at the very least, allocate primary shards so they become operations. A new setting, cluster.routing.allocation.disable_new_allocation, allows to also disable "new" allocations.
closes #2258.
This commit is contained in:
Shay Banon 2012-09-17 16:00:55 +02:00
parent 90e0a70e0e
commit 7924115b90
36 changed files with 170 additions and 158 deletions

View File

@ -319,7 +319,7 @@ public class MetaDataCreateIndexService extends AbstractComponent {
if (request.state == State.OPEN) { if (request.state == State.OPEN) {
RoutingTable.Builder routingTableBuilder = RoutingTable.builder().routingTable(updatedState.routingTable()) RoutingTable.Builder routingTableBuilder = RoutingTable.builder().routingTable(updatedState.routingTable())
.add(updatedState.metaData().index(request.index), true); .addAsNew(updatedState.metaData().index(request.index));
RoutingAllocation.Result routingResult = allocationService.reroute(newClusterStateBuilder().state(updatedState).routingTable(routingTableBuilder).build()); RoutingAllocation.Result routingResult = allocationService.reroute(newClusterStateBuilder().state(updatedState).routingTable(routingTableBuilder).build());
updatedState = newClusterStateBuilder().state(updatedState).routingResult(routingResult).build(); updatedState = newClusterStateBuilder().state(updatedState).routingResult(routingResult).build();
} }

View File

@ -127,7 +127,7 @@ public class MetaDataStateIndexService extends AbstractComponent {
ClusterState updatedState = ClusterState.builder().state(currentState).metaData(mdBuilder).blocks(blocks).build(); ClusterState updatedState = ClusterState.builder().state(currentState).metaData(mdBuilder).blocks(blocks).build();
RoutingTable.Builder rtBuilder = RoutingTable.builder().routingTable(updatedState.routingTable()) RoutingTable.Builder rtBuilder = RoutingTable.builder().routingTable(updatedState.routingTable())
.add(updatedState.metaData().index(request.index), false); .addAsRecovery(updatedState.metaData().index(request.index));
RoutingAllocation.Result routingResult = allocationService.reroute(newClusterStateBuilder().state(updatedState).routingTable(rtBuilder).build()); RoutingAllocation.Result routingResult = allocationService.reroute(newClusterStateBuilder().state(updatedState).routingTable(rtBuilder).build());

View File

@ -23,10 +23,12 @@ import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import com.google.common.collect.UnmodifiableIterator; import com.google.common.collect.UnmodifiableIterator;
import org.elasticsearch.ElasticSearchIllegalStateException;
import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.cluster.metadata.IndexMetaData;
import org.elasticsearch.cluster.metadata.MetaData; import org.elasticsearch.cluster.metadata.MetaData;
import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.index.shard.ShardId;
import java.io.IOException; import java.io.IOException;
import java.util.*; import java.util.*;
@ -270,18 +272,30 @@ public class IndexRoutingTable implements Iterable<IndexShardRoutingTable> {
/** /**
* Initializes a new empty index, as if it was created from an API. * Initializes a new empty index, as if it was created from an API.
*/ */
public Builder initializeEmpty(IndexMetaData indexMetaData) { public Builder initializeAsNew(IndexMetaData indexMetaData) {
return initializeEmpty(indexMetaData, true); return initializeEmpty(indexMetaData, true);
} }
/**
* Initializes a new empty index, as if it was created from an API.
*/
public Builder initializeAsRecovery(IndexMetaData indexMetaData) {
return initializeEmpty(indexMetaData, false);
}
/** /**
* Initializes a new empty index, with an option to control if its from an API or not. * Initializes a new empty index, with an option to control if its from an API or not.
*/ */
public Builder initializeEmpty(IndexMetaData indexMetaData, boolean fromApi) { private Builder initializeEmpty(IndexMetaData indexMetaData, boolean asNew) {
if (!shards.isEmpty()) {
throw new ElasticSearchIllegalStateException("trying to initialize an index with fresh shards, but already has shards created");
}
for (int shardId = 0; shardId < indexMetaData.numberOfShards(); shardId++) { for (int shardId = 0; shardId < indexMetaData.numberOfShards(); shardId++) {
IndexShardRoutingTable.Builder indexShardRoutingBuilder = new IndexShardRoutingTable.Builder(new ShardId(indexMetaData.index(), shardId), asNew ? false : true);
for (int i = 0; i <= indexMetaData.numberOfReplicas(); i++) { for (int i = 0; i <= indexMetaData.numberOfReplicas(); i++) {
addShard(shardId, null, i == 0, ShardRoutingState.UNASSIGNED, 0, fromApi); indexShardRoutingBuilder.addShard(new ImmutableShardRouting(index, shardId, null, i == 0, ShardRoutingState.UNASSIGNED, 0));
} }
shards.put(shardId, indexShardRoutingBuilder.build());
} }
return this; return this;
} }
@ -289,7 +303,10 @@ public class IndexRoutingTable implements Iterable<IndexShardRoutingTable> {
public Builder addReplica() { public Builder addReplica() {
for (int shardId : shards.keySet()) { for (int shardId : shards.keySet()) {
// version 0, will get updated when reroute will happen // version 0, will get updated when reroute will happen
addShard(shardId, null, false, ShardRoutingState.UNASSIGNED, 0, false); ImmutableShardRouting shard = new ImmutableShardRouting(index, shardId, null, false, ShardRoutingState.UNASSIGNED, 0);
shards.put(shardId,
new IndexShardRoutingTable.Builder(shards.get(shard.id())).addShard(shard).build()
);
} }
return this; return this;
} }
@ -302,7 +319,7 @@ public class IndexRoutingTable implements Iterable<IndexShardRoutingTable> {
return this; return this;
} }
// re-add all the current ones // re-add all the current ones
IndexShardRoutingTable.Builder builder = new IndexShardRoutingTable.Builder(indexShard.shardId(), indexShard.allocatedPostApi()); IndexShardRoutingTable.Builder builder = new IndexShardRoutingTable.Builder(indexShard.shardId(), indexShard.primaryAllocatedPostApi());
for (ShardRouting shardRouting : indexShard) { for (ShardRouting shardRouting : indexShard) {
builder.addShard(new ImmutableShardRouting(shardRouting)); builder.addShard(new ImmutableShardRouting(shardRouting));
} }
@ -334,21 +351,16 @@ public class IndexRoutingTable implements Iterable<IndexShardRoutingTable> {
return this; return this;
} }
public Builder addShard(ShardRouting shard, boolean fromApi) { /**
return internalAddShard(new ImmutableShardRouting(shard), fromApi); * Adds a new shard routing (makes a copy of it), with reference data used from the index shard routing table
} * if it needs to be created.
*/
private Builder addShard(int shardId, String nodeId, boolean primary, ShardRoutingState state, long version, boolean fromApi) { public Builder addShard(IndexShardRoutingTable refData, ShardRouting shard) {
ImmutableShardRouting shard = new ImmutableShardRouting(index, shardId, nodeId, primary, state, version);
return internalAddShard(shard, fromApi);
}
private Builder internalAddShard(ImmutableShardRouting shard, boolean fromApi) {
IndexShardRoutingTable indexShard = shards.get(shard.id()); IndexShardRoutingTable indexShard = shards.get(shard.id());
if (indexShard == null) { if (indexShard == null) {
indexShard = new IndexShardRoutingTable.Builder(shard.shardId(), fromApi ? false : true).addShard(shard).build(); indexShard = new IndexShardRoutingTable.Builder(refData.shardId(), refData.primaryAllocatedPostApi()).addShard(new ImmutableShardRouting(shard)).build();
} else { } else {
indexShard = new IndexShardRoutingTable.Builder(indexShard).addShard(shard).build(); indexShard = new IndexShardRoutingTable.Builder(indexShard).addShard(new ImmutableShardRouting(shard)).build();
} }
shards.put(indexShard.shardId().id(), indexShard); shards.put(indexShard.shardId().id(), indexShard);
return this; return this;

View File

@ -51,12 +51,12 @@ public class IndexShardRoutingTable implements Iterable<ShardRouting> {
final AtomicInteger counter; final AtomicInteger counter;
final boolean allocatedPostApi; final boolean primaryAllocatedPostApi;
IndexShardRoutingTable(ShardId shardId, ImmutableList<ShardRouting> shards, boolean allocatedPostApi) { IndexShardRoutingTable(ShardId shardId, ImmutableList<ShardRouting> shards, boolean primaryAllocatedPostApi) {
this.shardId = shardId; this.shardId = shardId;
this.shards = shards; this.shards = shards;
this.allocatedPostApi = allocatedPostApi; this.primaryAllocatedPostApi = primaryAllocatedPostApi;
this.counter = new AtomicInteger(ThreadLocalRandom.current().nextInt(shards.size())); this.counter = new AtomicInteger(ThreadLocalRandom.current().nextInt(shards.size()));
ShardRouting primary = null; ShardRouting primary = null;
@ -120,15 +120,15 @@ public class IndexShardRoutingTable implements Iterable<ShardRouting> {
shardRoutings.add(new ImmutableShardRouting(shards.get(i), highestVersion)); shardRoutings.add(new ImmutableShardRouting(shards.get(i), highestVersion));
} }
} }
return new IndexShardRoutingTable(shardId, ImmutableList.copyOf(shardRoutings), allocatedPostApi); return new IndexShardRoutingTable(shardId, ImmutableList.copyOf(shardRoutings), primaryAllocatedPostApi);
} }
/** /**
* Has this shard group primary shard been allocated post API creation. Will be set to * Has this shard group primary shard been allocated post API creation. Will be set to
* <tt>true</tt> if it was created because of recovery action. * <tt>true</tt> if it was created because of recovery action.
*/ */
public boolean allocatedPostApi() { public boolean primaryAllocatedPostApi() {
return allocatedPostApi; return primaryAllocatedPostApi;
} }
public ShardId shardId() { public ShardId shardId() {
@ -404,18 +404,18 @@ public class IndexShardRoutingTable implements Iterable<ShardRouting> {
private final List<ShardRouting> shards; private final List<ShardRouting> shards;
private boolean allocatedPostApi; private boolean primaryAllocatedPostApi;
public Builder(IndexShardRoutingTable indexShard) { public Builder(IndexShardRoutingTable indexShard) {
this.shardId = indexShard.shardId; this.shardId = indexShard.shardId;
this.shards = newArrayList(indexShard.shards); this.shards = newArrayList(indexShard.shards);
this.allocatedPostApi = indexShard.allocatedPostApi(); this.primaryAllocatedPostApi = indexShard.primaryAllocatedPostApi();
} }
public Builder(ShardId shardId, boolean allocatedPostApi) { public Builder(ShardId shardId, boolean primaryAllocatedPostApi) {
this.shardId = shardId; this.shardId = shardId;
this.shards = newArrayList(); this.shards = newArrayList();
this.allocatedPostApi = allocatedPostApi; this.primaryAllocatedPostApi = primaryAllocatedPostApi;
} }
public Builder addShard(ImmutableShardRouting shardEntry) { public Builder addShard(ImmutableShardRouting shardEntry) {
@ -438,14 +438,14 @@ public class IndexShardRoutingTable implements Iterable<ShardRouting> {
public IndexShardRoutingTable build() { public IndexShardRoutingTable build() {
// we can automatically set allocatedPostApi to true if the primary is active // we can automatically set allocatedPostApi to true if the primary is active
if (!allocatedPostApi) { if (!primaryAllocatedPostApi) {
for (ShardRouting shardRouting : shards) { for (ShardRouting shardRouting : shards) {
if (shardRouting.primary() && shardRouting.active()) { if (shardRouting.primary() && shardRouting.active()) {
allocatedPostApi = true; primaryAllocatedPostApi = true;
} }
} }
} }
return new IndexShardRoutingTable(shardId, ImmutableList.copyOf(shards), allocatedPostApi); return new IndexShardRoutingTable(shardId, ImmutableList.copyOf(shards), primaryAllocatedPostApi);
} }
public static IndexShardRoutingTable readFrom(StreamInput in) throws IOException { public static IndexShardRoutingTable readFrom(StreamInput in) throws IOException {
@ -474,7 +474,7 @@ public class IndexShardRoutingTable implements Iterable<ShardRouting> {
public static void writeToThin(IndexShardRoutingTable indexShard, StreamOutput out) throws IOException { public static void writeToThin(IndexShardRoutingTable indexShard, StreamOutput out) throws IOException {
out.writeVInt(indexShard.shardId.id()); out.writeVInt(indexShard.shardId.id());
out.writeBoolean(indexShard.allocatedPostApi()); out.writeBoolean(indexShard.primaryAllocatedPostApi());
out.writeVInt(indexShard.shards.size()); out.writeVInt(indexShard.shards.size());
for (ShardRouting entry : indexShard) { for (ShardRouting entry : indexShard) {

View File

@ -285,8 +285,8 @@ public class RoutingTable implements Iterable<IndexRoutingTable> {
indexRoutingTableBuilders.put(index, indexBuilder); indexRoutingTableBuilders.put(index, indexBuilder);
} }
boolean allocatedPostApi = routingNodes.routingTable().index(shardRoutingEntry.index()).shard(shardRoutingEntry.id()).allocatedPostApi(); IndexShardRoutingTable refData = routingNodes.routingTable().index(shardRoutingEntry.index()).shard(shardRoutingEntry.id());
indexBuilder.addShard(new ImmutableShardRouting(shardRoutingEntry), !allocatedPostApi); indexBuilder.addShard(refData, shardRoutingEntry);
} }
} }
for (MutableShardRouting shardRoutingEntry : Iterables.concat(routingNodes.unassigned(), routingNodes.ignoredUnassigned())) { for (MutableShardRouting shardRoutingEntry : Iterables.concat(routingNodes.unassigned(), routingNodes.ignoredUnassigned())) {
@ -296,8 +296,8 @@ public class RoutingTable implements Iterable<IndexRoutingTable> {
indexBuilder = new IndexRoutingTable.Builder(index); indexBuilder = new IndexRoutingTable.Builder(index);
indexRoutingTableBuilders.put(index, indexBuilder); indexRoutingTableBuilders.put(index, indexBuilder);
} }
boolean allocatedPostApi = routingNodes.routingTable().index(shardRoutingEntry.index()).shard(shardRoutingEntry.id()).allocatedPostApi(); IndexShardRoutingTable refData = routingNodes.routingTable().index(shardRoutingEntry.index()).shard(shardRoutingEntry.id());
indexBuilder.addShard(new ImmutableShardRouting(shardRoutingEntry), !allocatedPostApi); indexBuilder.addShard(refData, shardRoutingEntry);
} }
for (IndexRoutingTable.Builder indexBuilder : indexRoutingTableBuilders.values()) { for (IndexRoutingTable.Builder indexBuilder : indexRoutingTableBuilders.values()) {
add(indexBuilder); add(indexBuilder);
@ -341,10 +341,19 @@ public class RoutingTable implements Iterable<IndexRoutingTable> {
return this; return this;
} }
public Builder add(IndexMetaData indexMetaData, boolean fromApi) { public Builder addAsNew(IndexMetaData indexMetaData) {
if (indexMetaData.state() == IndexMetaData.State.OPEN) { if (indexMetaData.state() == IndexMetaData.State.OPEN) {
IndexRoutingTable.Builder indexRoutingBuilder = new IndexRoutingTable.Builder(indexMetaData.index()) IndexRoutingTable.Builder indexRoutingBuilder = new IndexRoutingTable.Builder(indexMetaData.index())
.initializeEmpty(indexMetaData, fromApi); .initializeAsNew(indexMetaData);
add(indexRoutingBuilder);
}
return this;
}
public Builder addAsRecovery(IndexMetaData indexMetaData) {
if (indexMetaData.state() == IndexMetaData.State.OPEN) {
IndexRoutingTable.Builder indexRoutingBuilder = new IndexRoutingTable.Builder(indexMetaData.index())
.initializeAsRecovery(indexMetaData);
add(indexRoutingBuilder); add(indexRoutingBuilder);
} }
return this; return this;

View File

@ -33,6 +33,7 @@ public class DisableAllocationDecider extends AllocationDecider {
static { static {
MetaData.addDynamicSettings( MetaData.addDynamicSettings(
"cluster.routing.allocation.disable_new_allocation",
"cluster.routing.allocation.disable_allocation", "cluster.routing.allocation.disable_allocation",
"cluster.routing.allocation.disable_replica_allocation" "cluster.routing.allocation.disable_replica_allocation"
); );
@ -41,6 +42,12 @@ public class DisableAllocationDecider extends AllocationDecider {
class ApplySettings implements NodeSettingsService.Listener { class ApplySettings implements NodeSettingsService.Listener {
@Override @Override
public void onRefreshSettings(Settings settings) { public void onRefreshSettings(Settings settings) {
boolean disableNewAllocation = settings.getAsBoolean("cluster.routing.allocation.disable_new_allocation", DisableAllocationDecider.this.disableNewAllocation);
if (disableNewAllocation != DisableAllocationDecider.this.disableNewAllocation) {
logger.info("updating [cluster.routing.allocation.disable_new_allocation] from [{}] to [{}]", DisableAllocationDecider.this.disableNewAllocation, disableNewAllocation);
DisableAllocationDecider.this.disableNewAllocation = disableNewAllocation;
}
boolean disableAllocation = settings.getAsBoolean("cluster.routing.allocation.disable_allocation", DisableAllocationDecider.this.disableAllocation); boolean disableAllocation = settings.getAsBoolean("cluster.routing.allocation.disable_allocation", DisableAllocationDecider.this.disableAllocation);
if (disableAllocation != DisableAllocationDecider.this.disableAllocation) { if (disableAllocation != DisableAllocationDecider.this.disableAllocation) {
logger.info("updating [cluster.routing.allocation.disable_allocation] from [{}] to [{}]", DisableAllocationDecider.this.disableAllocation, disableAllocation); logger.info("updating [cluster.routing.allocation.disable_allocation] from [{}] to [{}]", DisableAllocationDecider.this.disableAllocation, disableAllocation);
@ -55,12 +62,14 @@ public class DisableAllocationDecider extends AllocationDecider {
} }
} }
private volatile boolean disableNewAllocation;
private volatile boolean disableAllocation; private volatile boolean disableAllocation;
private volatile boolean disableReplicaAllocation; private volatile boolean disableReplicaAllocation;
@Inject @Inject
public DisableAllocationDecider(Settings settings, NodeSettingsService nodeSettingsService) { public DisableAllocationDecider(Settings settings, NodeSettingsService nodeSettingsService) {
super(settings); super(settings);
this.disableNewAllocation = settings.getAsBoolean("cluster.routing.allocation.disable_new_allocation", false);
this.disableAllocation = settings.getAsBoolean("cluster.routing.allocation.disable_allocation", false); this.disableAllocation = settings.getAsBoolean("cluster.routing.allocation.disable_allocation", false);
this.disableReplicaAllocation = settings.getAsBoolean("cluster.routing.allocation.disable_replica_allocation", false); this.disableReplicaAllocation = settings.getAsBoolean("cluster.routing.allocation.disable_replica_allocation", false);
@ -69,6 +78,11 @@ public class DisableAllocationDecider extends AllocationDecider {
@Override @Override
public Decision canAllocate(ShardRouting shardRouting, RoutingNode node, RoutingAllocation allocation) { public Decision canAllocate(ShardRouting shardRouting, RoutingNode node, RoutingAllocation allocation) {
if (shardRouting.primary() && !allocation.routingNodes().routingTable().index(shardRouting.index()).shard(shardRouting.id()).primaryAllocatedPostApi()) {
// if its primary, and it hasn't been allocated post API (meaning its a "fresh newly created shard"), only disable allocation
// on a special disable allocation flag
return allocation.ignoreDisable() ? Decision.YES : disableNewAllocation ? Decision.NO : Decision.YES;
}
if (disableAllocation) { if (disableAllocation) {
return allocation.ignoreDisable() ? Decision.YES : Decision.NO; return allocation.ignoreDisable() ? Decision.YES : Decision.NO;
} }

View File

@ -269,7 +269,7 @@ public class GatewayService extends AbstractLifecycleComponent<GatewayService> i
// initialize all index routing tables as empty // initialize all index routing tables as empty
RoutingTable.Builder routingTableBuilder = RoutingTable.builder().routingTable(updatedState.routingTable()); RoutingTable.Builder routingTableBuilder = RoutingTable.builder().routingTable(updatedState.routingTable());
for (IndexMetaData indexMetaData : updatedState.metaData().indices().values()) { for (IndexMetaData indexMetaData : updatedState.metaData().indices().values()) {
routingTableBuilder.add(indexMetaData, false /* not from API */); routingTableBuilder.addAsRecovery(indexMetaData);
} }
// start with 0 based versions for routing table // start with 0 based versions for routing table
routingTableBuilder.version(0); routingTableBuilder.version(0);

View File

@ -118,7 +118,7 @@ public class LocalGatewayAllocator extends AbstractComponent implements GatewayA
} }
// this is an API allocation, ignore since we know there is no data... // this is an API allocation, ignore since we know there is no data...
if (!routingNodes.routingTable().index(shard.index()).shard(shard.id()).allocatedPostApi()) { if (!routingNodes.routingTable().index(shard.index()).shard(shard.id()).primaryAllocatedPostApi()) {
continue; continue;
} }

View File

@ -140,7 +140,7 @@ public class LocalAllocateDangledIndices extends AbstractComponent {
importNeeded = true; importNeeded = true;
metaData.put(indexMetaData, false); metaData.put(indexMetaData, false);
blocks.addBlocks(indexMetaData); blocks.addBlocks(indexMetaData);
routingTableBuilder.add(indexMetaData, false); routingTableBuilder.addAsRecovery(indexMetaData);
sb.append("[").append(indexMetaData.index()).append("/").append(indexMetaData.state()).append("]"); sb.append("[").append(indexMetaData.index()).append("/").append(indexMetaData.state()).append("]");
} }
if (!importNeeded) { if (!importNeeded) {

View File

@ -616,7 +616,7 @@ public class IndicesClusterStateService extends AbstractLifecycleComponent<Indic
if (shardRouting.relocatingNodeId() == null) { if (shardRouting.relocatingNodeId() == null) {
// we are the first primary, recover from the gateway // we are the first primary, recover from the gateway
// if its post api allocation, the index should exists // if its post api allocation, the index should exists
boolean indexShouldExists = indexShardRouting.allocatedPostApi(); boolean indexShouldExists = indexShardRouting.primaryAllocatedPostApi();
IndexShardGatewayService shardGatewayService = indexService.shardInjector(shardId).getInstance(IndexShardGatewayService.class); IndexShardGatewayService shardGatewayService = indexService.shardInjector(shardId).getInstance(IndexShardGatewayService.class);
shardGatewayService.recover(indexShouldExists, new IndexShardGatewayService.RecoveryListener() { shardGatewayService.recover(indexShouldExists, new IndexShardGatewayService.RecoveryListener() {
@Override @Override

View File

@ -60,6 +60,7 @@ public class ClusterRerouteTests extends AbstractNodesTests {
@Test @Test
public void rerouteWithCommands() throws Exception { public void rerouteWithCommands() throws Exception {
Settings commonSettings = settingsBuilder() Settings commonSettings = settingsBuilder()
.put("cluster.routing.allocation.disable_new_allocation", true)
.put("cluster.routing.allocation.disable_allocation", true) .put("cluster.routing.allocation.disable_allocation", true)
.build(); .build();
@ -122,6 +123,7 @@ public class ClusterRerouteTests extends AbstractNodesTests {
@Test @Test
public void rerouteWithAllocateLocalGateway() throws Exception { public void rerouteWithAllocateLocalGateway() throws Exception {
Settings commonSettings = settingsBuilder() Settings commonSettings = settingsBuilder()
.put("cluster.routing.allocation.disable_new_allocation", true)
.put("cluster.routing.allocation.disable_allocation", true) .put("cluster.routing.allocation.disable_allocation", true)
.put("gateway.type", "local") .put("gateway.type", "local")
.build(); .build();

View File

@ -32,7 +32,6 @@ import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder; import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder; import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder;
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder; 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.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
@ -56,20 +55,20 @@ public class AllocatePostApiFlagTests {
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(0)) .put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(0))
.build(); .build();
RoutingTable routingTable = routingTable() RoutingTable routingTable = routingTable()
.add(indexRoutingTable("test").initializeEmpty(metaData.index("test"))) .addAsNew(metaData.index("test"))
.build(); .build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build(); ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();
assertThat(clusterState.routingTable().index("test").shard(0).allocatedPostApi(), equalTo(false)); assertThat(clusterState.routingTable().index("test").shard(0).primaryAllocatedPostApi(), equalTo(false));
logger.info("adding two nodes and performing rerouting"); logger.info("adding two nodes and performing rerouting");
clusterState = newClusterStateBuilder().state(clusterState).nodes(newNodesBuilder().put(newNode("node1")).put(newNode("node2"))).build(); clusterState = newClusterStateBuilder().state(clusterState).nodes(newNodesBuilder().put(newNode("node1")).put(newNode("node2"))).build();
RoutingAllocation.Result rerouteResult = allocation.reroute(clusterState); RoutingAllocation.Result rerouteResult = allocation.reroute(clusterState);
clusterState = newClusterStateBuilder().state(clusterState).routingTable(rerouteResult.routingTable()).build(); clusterState = newClusterStateBuilder().state(clusterState).routingTable(rerouteResult.routingTable()).build();
assertThat(clusterState.routingTable().index("test").shard(0).allocatedPostApi(), equalTo(false)); assertThat(clusterState.routingTable().index("test").shard(0).primaryAllocatedPostApi(), equalTo(false));
logger.info("start primary shard"); logger.info("start primary shard");
rerouteResult = allocation.applyStartedShards(clusterState, clusterState.routingNodes().shardsWithState(INITIALIZING)); rerouteResult = allocation.applyStartedShards(clusterState, clusterState.routingNodes().shardsWithState(INITIALIZING));
clusterState = newClusterStateBuilder().state(clusterState).routingTable(rerouteResult.routingTable()).build(); clusterState = newClusterStateBuilder().state(clusterState).routingTable(rerouteResult.routingTable()).build();
assertThat(clusterState.routingTable().index("test").shard(0).allocatedPostApi(), equalTo(true)); assertThat(clusterState.routingTable().index("test").shard(0).primaryAllocatedPostApi(), equalTo(true));
} }
} }

View File

@ -44,7 +44,6 @@ import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder; import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder; import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder;
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder; 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.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED; import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
@ -69,7 +68,7 @@ public class AllocationCommandsTests {
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(0)) .put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(0))
.build(); .build();
RoutingTable routingTable = routingTable() RoutingTable routingTable = routingTable()
.add(indexRoutingTable("test").initializeEmpty(metaData.index("test"))) .addAsNew(metaData.index("test"))
.build(); .build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build(); ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();
@ -107,6 +106,7 @@ public class AllocationCommandsTests {
@Test @Test
public void allocateCommand() { public void allocateCommand() {
AllocationService allocation = new AllocationService(settingsBuilder() AllocationService allocation = new AllocationService(settingsBuilder()
.put("cluster.routing.allocation.disable_new_allocation", true)
.put("cluster.routing.allocation.disable_allocation", true) .put("cluster.routing.allocation.disable_allocation", true)
.build()); .build());
@ -115,7 +115,7 @@ public class AllocationCommandsTests {
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1)) .put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
.build(); .build();
RoutingTable routingTable = routingTable() RoutingTable routingTable = routingTable()
.add(indexRoutingTable("test").initializeEmpty(metaData.index("test"))) .addAsNew(metaData.index("test"))
.build(); .build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build(); ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();
@ -187,6 +187,7 @@ public class AllocationCommandsTests {
@Test @Test
public void cancelCommand() { public void cancelCommand() {
AllocationService allocation = new AllocationService(settingsBuilder() AllocationService allocation = new AllocationService(settingsBuilder()
.put("cluster.routing.allocation.disable_new_allocation", true)
.put("cluster.routing.allocation.disable_allocation", true) .put("cluster.routing.allocation.disable_allocation", true)
.build()); .build());
@ -195,7 +196,7 @@ public class AllocationCommandsTests {
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1)) .put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
.build(); .build();
RoutingTable routingTable = routingTable() RoutingTable routingTable = routingTable()
.add(indexRoutingTable("test").initializeEmpty(metaData.index("test"))) .addAsNew(metaData.index("test"))
.build(); .build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build(); ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();

View File

@ -33,11 +33,10 @@ import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder; import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder; import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder;
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder; 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.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.*; 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.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.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.*; import static org.hamcrest.Matchers.*;
@ -63,7 +62,7 @@ public class AwarenessAllocationTests {
.build(); .build();
RoutingTable routingTable = routingTable() RoutingTable routingTable = routingTable()
.add(indexRoutingTable("test").initializeEmpty(metaData.index("test"))) .addAsNew(metaData.index("test"))
.build(); .build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build(); ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();
@ -132,7 +131,7 @@ public class AwarenessAllocationTests {
.build(); .build();
RoutingTable routingTable = routingTable() RoutingTable routingTable = routingTable()
.add(indexRoutingTable("test").initializeEmpty(metaData.index("test"))) .addAsNew(metaData.index("test"))
.build(); .build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build(); ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();
@ -204,7 +203,7 @@ public class AwarenessAllocationTests {
.build(); .build();
RoutingTable routingTable = routingTable() RoutingTable routingTable = routingTable()
.add(indexRoutingTable("test").initializeEmpty(metaData.index("test"))) .addAsNew(metaData.index("test"))
.build(); .build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build(); ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();
@ -289,8 +288,8 @@ public class AwarenessAllocationTests {
.build(); .build();
RoutingTable routingTable = routingTable() RoutingTable routingTable = routingTable()
.add(indexRoutingTable("test1").initializeEmpty(metaData.index("test1"))) .addAsNew(metaData.index("test1"))
.add(indexRoutingTable("test2").initializeEmpty(metaData.index("test2"))) .addAsNew(metaData.index("test2"))
.build(); .build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build(); ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();
@ -372,7 +371,7 @@ public class AwarenessAllocationTests {
.build(); .build();
RoutingTable routingTable = routingTable() RoutingTable routingTable = routingTable()
.add(indexRoutingTable("test").initializeEmpty(metaData.index("test"))) .addAsNew(metaData.index("test"))
.build(); .build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build(); ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();
@ -451,7 +450,7 @@ public class AwarenessAllocationTests {
.build(); .build();
RoutingTable routingTable = routingTable() RoutingTable routingTable = routingTable()
.add(indexRoutingTable("test").initializeEmpty(metaData.index("test"))) .addAsNew(metaData.index("test"))
.build(); .build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build(); ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();
@ -533,7 +532,7 @@ public class AwarenessAllocationTests {
.build(); .build();
RoutingTable routingTable = routingTable() RoutingTable routingTable = routingTable()
.add(indexRoutingTable("test").initializeEmpty(metaData.index("test"))) .addAsNew(metaData.index("test"))
.build(); .build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build(); ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();
@ -601,7 +600,7 @@ public class AwarenessAllocationTests {
.build(); .build();
RoutingTable routingTable = routingTable() RoutingTable routingTable = routingTable()
.add(indexRoutingTable("test").initializeEmpty(metaData.index("test"))) .addAsNew(metaData.index("test"))
.build(); .build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build(); ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();
@ -673,8 +672,8 @@ public class AwarenessAllocationTests {
.build(); .build();
RoutingTable routingTable = routingTable() RoutingTable routingTable = routingTable()
.add(indexRoutingTable("test1").initializeEmpty(metaData.index("test1"))) .addAsNew(metaData.index("test1"))
.add(indexRoutingTable("test2").initializeEmpty(metaData.index("test2"))) .addAsNew(metaData.index("test2"))
.build(); .build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build(); ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();

View File

@ -33,7 +33,6 @@ import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder; import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder; import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder;
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder; 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.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.*; import static org.elasticsearch.cluster.routing.ShardRoutingState.*;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
@ -56,8 +55,8 @@ public class ClusterRebalanceRoutingTests {
.build(); .build();
RoutingTable routingTable = routingTable() RoutingTable routingTable = routingTable()
.add(indexRoutingTable("test1").initializeEmpty(metaData.index("test1"))) .addAsNew(metaData.index("test1"))
.add(indexRoutingTable("test2").initializeEmpty(metaData.index("test2"))) .addAsNew(metaData.index("test2"))
.build(); .build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build(); ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();
@ -142,8 +141,8 @@ public class ClusterRebalanceRoutingTests {
.build(); .build();
RoutingTable routingTable = routingTable() RoutingTable routingTable = routingTable()
.add(indexRoutingTable("test1").initializeEmpty(metaData.index("test1"))) .addAsNew(metaData.index("test1"))
.add(indexRoutingTable("test2").initializeEmpty(metaData.index("test2"))) .addAsNew(metaData.index("test2"))
.build(); .build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build(); ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();
@ -246,8 +245,8 @@ public class ClusterRebalanceRoutingTests {
.build(); .build();
RoutingTable routingTable = routingTable() RoutingTable routingTable = routingTable()
.add(indexRoutingTable("test1").initializeEmpty(metaData.index("test1"))) .addAsNew(metaData.index("test1"))
.add(indexRoutingTable("test2").initializeEmpty(metaData.index("test2"))) .addAsNew(metaData.index("test2"))
.build(); .build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build(); ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();
@ -330,8 +329,8 @@ public class ClusterRebalanceRoutingTests {
.build(); .build();
RoutingTable routingTable = routingTable() RoutingTable routingTable = routingTable()
.add(indexRoutingTable("test1").initializeEmpty(metaData.index("test1"))) .addAsNew(metaData.index("test1"))
.add(indexRoutingTable("test2").initializeEmpty(metaData.index("test2"))) .addAsNew(metaData.index("test2"))
.build(); .build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build(); ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();
@ -453,8 +452,8 @@ public class ClusterRebalanceRoutingTests {
.build(); .build();
RoutingTable routingTable = routingTable() RoutingTable routingTable = routingTable()
.add(indexRoutingTable("test1").initializeEmpty(metaData.index("test1"))) .addAsNew(metaData.index("test1"))
.add(indexRoutingTable("test2").initializeEmpty(metaData.index("test2"))) .addAsNew(metaData.index("test2"))
.build(); .build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build(); ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();
@ -537,8 +536,8 @@ public class ClusterRebalanceRoutingTests {
.build(); .build();
RoutingTable routingTable = routingTable() RoutingTable routingTable = routingTable()
.add(indexRoutingTable("test1").initializeEmpty(metaData.index("test1"))) .addAsNew(metaData.index("test1"))
.add(indexRoutingTable("test2").initializeEmpty(metaData.index("test2"))) .addAsNew(metaData.index("test2"))
.build(); .build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build(); ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();

View File

@ -32,7 +32,6 @@ import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder; import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder; import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder;
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder; 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.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.*; import static org.elasticsearch.cluster.routing.ShardRoutingState.*;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
@ -60,7 +59,7 @@ public class ConcurrentRebalanceRoutingTests {
.build(); .build();
RoutingTable routingTable = routingTable() RoutingTable routingTable = routingTable()
.add(indexRoutingTable("test").initializeEmpty(metaData.index("test"))) .addAsNew(metaData.index("test"))
.build(); .build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build(); ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();

View File

@ -34,7 +34,6 @@ import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder; import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder; import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder;
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder; 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.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.*; import static org.elasticsearch.cluster.routing.ShardRoutingState.*;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
@ -61,7 +60,7 @@ public class DeadNodesAllocationTests {
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1)) .put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
.build(); .build();
RoutingTable routingTable = routingTable() RoutingTable routingTable = routingTable()
.add(indexRoutingTable("test").initializeEmpty(metaData.index("test"))) .addAsNew(metaData.index("test"))
.build(); .build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build(); ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();
@ -113,7 +112,7 @@ public class DeadNodesAllocationTests {
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1)) .put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
.build(); .build();
RoutingTable routingTable = routingTable() RoutingTable routingTable = routingTable()
.add(indexRoutingTable("test").initializeEmpty(metaData.index("test"))) .addAsNew(metaData.index("test"))
.build(); .build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build(); ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();
@ -188,7 +187,7 @@ public class DeadNodesAllocationTests {
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1)) .put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
.build(); .build();
RoutingTable routingTable = routingTable() RoutingTable routingTable = routingTable()
.add(indexRoutingTable("test").initializeEmpty(metaData.index("test"))) .addAsNew(metaData.index("test"))
.build(); .build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build(); ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();

View File

@ -31,11 +31,10 @@ import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder; import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder; import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder;
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder; 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.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
import static org.elasticsearch.test.unit.cluster.routing.allocation.RoutingAllocationTests.newNode;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; 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.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
@ -49,6 +48,7 @@ public class DisableAllocationTests {
@Test @Test
public void testDisableAllocation() { public void testDisableAllocation() {
AllocationService strategy = new AllocationService(settingsBuilder() AllocationService strategy = new AllocationService(settingsBuilder()
.put("cluster.routing.allocation.disable_new_allocation", true)
.put("cluster.routing.allocation.disable_allocation", true) .put("cluster.routing.allocation.disable_allocation", true)
.build()); .build());
@ -59,7 +59,7 @@ public class DisableAllocationTests {
.build(); .build();
RoutingTable routingTable = routingTable() RoutingTable routingTable = routingTable()
.add(indexRoutingTable("test").initializeEmpty(metaData.index("test"))) .addAsNew(metaData.index("test"))
.build(); .build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build(); ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();
@ -88,7 +88,7 @@ public class DisableAllocationTests {
.build(); .build();
RoutingTable routingTable = routingTable() RoutingTable routingTable = routingTable()
.add(indexRoutingTable("test").initializeEmpty(metaData.index("test"))) .addAsNew(metaData.index("test"))
.build(); .build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build(); ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();

View File

@ -33,7 +33,6 @@ import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder; import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder; import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder;
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder; 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.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED; import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
@ -60,7 +59,7 @@ public class ElectReplicaAsPrimaryDuringRelocationTests {
.build(); .build();
RoutingTable routingTable = routingTable() RoutingTable routingTable = routingTable()
.add(indexRoutingTable("test").initializeEmpty(metaData.index("test"))) .addAsNew(metaData.index("test"))
.build(); .build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build(); ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();

View File

@ -34,11 +34,9 @@ import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder; import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder; import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder;
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder; 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.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED; import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
import static org.elasticsearch.test.unit.cluster.routing.allocation.RoutingAllocationTests.newNode;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
@ -57,8 +55,8 @@ public class FailedNodeRoutingTests {
.build(); .build();
RoutingTable routingTable = routingTable() RoutingTable routingTable = routingTable()
.add(indexRoutingTable("test1").initializeEmpty(metaData.index("test1"))) .addAsNew(metaData.index("test1"))
.add(indexRoutingTable("test2").initializeEmpty(metaData.index("test2"))) .addAsNew(metaData.index("test2"))
.build(); .build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build(); ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();
@ -117,8 +115,8 @@ public class FailedNodeRoutingTests {
.build(); .build();
RoutingTable routingTable = routingTable() RoutingTable routingTable = routingTable()
.add(indexRoutingTable("test1").initializeEmpty(metaData.index("test1"))) .addAsNew(metaData.index("test1"))
.add(indexRoutingTable("test2").initializeEmpty(metaData.index("test2"))) .addAsNew(metaData.index("test2"))
.build(); .build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build(); ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();

View File

@ -37,7 +37,6 @@ import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder; import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder; import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder;
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder; 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.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.*; import static org.elasticsearch.cluster.routing.ShardRoutingState.*;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
@ -65,7 +64,7 @@ public class FailedShardsRoutingTests {
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1)) .put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
.build(); .build();
RoutingTable routingTable = routingTable() RoutingTable routingTable = routingTable()
.add(indexRoutingTable("test").initializeEmpty(metaData.index("test"))) .addAsNew(metaData.index("test"))
.build(); .build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build(); ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();
@ -156,7 +155,7 @@ public class FailedShardsRoutingTests {
.build(); .build();
RoutingTable routingTable = routingTable() RoutingTable routingTable = routingTable()
.add(indexRoutingTable("test").initializeEmpty(metaData.index("test"))) .addAsNew(metaData.index("test"))
.build(); .build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build(); ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();
@ -237,7 +236,7 @@ public class FailedShardsRoutingTests {
.build(); .build();
RoutingTable routingTable = routingTable() RoutingTable routingTable = routingTable()
.add(indexRoutingTable("test").initializeEmpty(metaData.index("test"))) .addAsNew(metaData.index("test"))
.build(); .build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build(); ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();
@ -294,7 +293,7 @@ public class FailedShardsRoutingTests {
.build(); .build();
RoutingTable routingTable = routingTable() RoutingTable routingTable = routingTable()
.add(indexRoutingTable("test").initializeEmpty(metaData.index("test"))) .addAsNew(metaData.index("test"))
.build(); .build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build(); ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();
@ -351,7 +350,7 @@ public class FailedShardsRoutingTests {
.build(); .build();
RoutingTable routingTable = routingTable() RoutingTable routingTable = routingTable()
.add(indexRoutingTable("test").initializeEmpty(metaData.index("test"))) .addAsNew(metaData.index("test"))
.build(); .build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build(); ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();

View File

@ -37,11 +37,10 @@ import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder; import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder; import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder;
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder; 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.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
import static org.elasticsearch.test.unit.cluster.routing.allocation.RoutingAllocationTests.newNode;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; 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.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
@ -66,7 +65,7 @@ public class FilterRoutingTests {
.build(); .build();
RoutingTable routingTable = routingTable() RoutingTable routingTable = routingTable()
.add(indexRoutingTable("test").initializeEmpty(metaData.index("test"))) .addAsNew(metaData.index("test"))
.build(); .build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build(); ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();
@ -115,7 +114,7 @@ public class FilterRoutingTests {
.build(); .build();
RoutingTable routingTable = routingTable() RoutingTable routingTable = routingTable()
.add(indexRoutingTable("test").initializeEmpty(metaData.index("test"))) .addAsNew(metaData.index("test"))
.build(); .build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build(); ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();

View File

@ -32,12 +32,11 @@ import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder; import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder; import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder;
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder; 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.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED; import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
import static org.elasticsearch.test.unit.cluster.routing.allocation.RoutingAllocationTests.newNode;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; 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.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.nullValue; import static org.hamcrest.Matchers.nullValue;
@ -60,7 +59,7 @@ public class PrimaryElectionRoutingTests {
.build(); .build();
RoutingTable routingTable = routingTable() RoutingTable routingTable = routingTable()
.add(indexRoutingTable("test").initializeEmpty(metaData.index("test"))) .addAsNew(metaData.index("test"))
.build(); .build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build(); ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();

View File

@ -32,12 +32,11 @@ import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder; import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder; import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder;
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder; 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.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED; import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
import static org.elasticsearch.test.unit.cluster.routing.allocation.RoutingAllocationTests.newNode;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; 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.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
@ -63,7 +62,7 @@ public class PrimaryNotRelocatedWhileBeingRecoveredTests {
.build(); .build();
RoutingTable routingTable = routingTable() RoutingTable routingTable = routingTable()
.add(indexRoutingTable("test").initializeEmpty(metaData.index("test"))) .addAsNew(metaData.index("test"))
.build(); .build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build(); ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();

View File

@ -33,11 +33,10 @@ import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder; import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder; import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder;
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder; 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.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.*; 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.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.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.nullValue; import static org.hamcrest.Matchers.nullValue;
@ -64,7 +63,7 @@ public class RebalanceAfterActiveTests {
.build(); .build();
RoutingTable routingTable = routingTable() RoutingTable routingTable = routingTable()
.add(indexRoutingTable("test").initializeEmpty(metaData.index("test"))) .addAsNew(metaData.index("test"))
.build(); .build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build(); ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();

View File

@ -32,11 +32,10 @@ import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder; import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder; import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder;
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder; 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.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.*; 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.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.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.nullValue; import static org.hamcrest.Matchers.nullValue;
@ -59,7 +58,7 @@ public class ReplicaAllocatedAfterPrimaryTests {
.build(); .build();
RoutingTable routingTable = routingTable() RoutingTable routingTable = routingTable()
.add(indexRoutingTable("test").initializeEmpty(metaData.index("test"))) .addAsNew(metaData.index("test"))
.build(); .build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build(); ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();

View File

@ -16,7 +16,6 @@ import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder; import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder; import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder;
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder; 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.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
@ -40,7 +39,7 @@ public class SameShardRoutingTests {
.build(); .build();
RoutingTable routingTable = routingTable() RoutingTable routingTable = routingTable()
.add(indexRoutingTable("test").initializeEmpty(metaData.index("test"))) .addAsNew(metaData.index("test"))
.build(); .build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build(); ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();

View File

@ -33,11 +33,10 @@ import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder; import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder; import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder;
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder; 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.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.*; 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.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.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
@ -56,8 +55,8 @@ public class ShardVersioningTests {
.build(); .build();
RoutingTable routingTable = routingTable() RoutingTable routingTable = routingTable()
.add(indexRoutingTable("test1").initializeEmpty(metaData.index("test1"))) .addAsNew(metaData.index("test1"))
.add(indexRoutingTable("test2").initializeEmpty(metaData.index("test2"))) .addAsNew(metaData.index("test2"))
.build(); .build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build(); ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();

View File

@ -37,7 +37,6 @@ import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder; import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder; import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder;
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder; 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.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.*; import static org.elasticsearch.cluster.routing.ShardRoutingState.*;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
@ -66,7 +65,7 @@ public class ShardsLimitAllocationTests {
.build(); .build();
RoutingTable routingTable = routingTable() RoutingTable routingTable = routingTable()
.add(indexRoutingTable("test").initializeEmpty(metaData.index("test"))) .addAsNew(metaData.index("test"))
.build(); .build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build(); ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();
@ -113,7 +112,7 @@ public class ShardsLimitAllocationTests {
.build(); .build();
RoutingTable routingTable = routingTable() RoutingTable routingTable = routingTable()
.add(indexRoutingTable("test").initializeEmpty(metaData.index("test"))) .addAsNew(metaData.index("test"))
.build(); .build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build(); ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();
@ -137,7 +136,7 @@ public class ShardsLimitAllocationTests {
)) ))
.build(); .build();
routingTable = routingTable().routingTable(routingTable) routingTable = routingTable().routingTable(routingTable)
.add(indexRoutingTable("test1").initializeEmpty(metaData.index("test1"))) .addAsNew(metaData.index("test1"))
.build(); .build();
clusterState = newClusterStateBuilder().state(clusterState).metaData(metaData).routingTable(routingTable).build(); clusterState = newClusterStateBuilder().state(clusterState).metaData(metaData).routingTable(routingTable).build();

View File

@ -41,10 +41,8 @@ import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder; import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder; import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder;
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder; 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.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.*; 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.common.settings.ImmutableSettings.settingsBuilder;
import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.*; import static org.hamcrest.Matchers.*;
@ -67,7 +65,7 @@ public class SingleShardNoReplicasRoutingTests {
.build(); .build();
RoutingTable routingTable = routingTable() RoutingTable routingTable = routingTable()
.add(indexRoutingTable("test").initializeEmpty(metaData.index("test"))) .addAsNew(metaData.index("test"))
.build(); .build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build(); ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();
@ -169,7 +167,7 @@ public class SingleShardNoReplicasRoutingTests {
.build(); .build();
RoutingTable routingTable = routingTable() RoutingTable routingTable = routingTable()
.add(indexRoutingTable("test").initializeEmpty(metaData.index("test"))) .addAsNew(metaData.index("test"))
.build(); .build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build(); ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();
@ -227,7 +225,7 @@ public class SingleShardNoReplicasRoutingTests {
RoutingTable.Builder routingTableBuilder = routingTable(); RoutingTable.Builder routingTableBuilder = routingTable();
for (int i = 0; i < numberOfIndices; i++) { for (int i = 0; i < numberOfIndices; i++) {
routingTableBuilder.add(indexRoutingTable("test" + i).initializeEmpty(metaData.index("test" + i))); routingTableBuilder.addAsNew(metaData.index("test" + i));
} }
RoutingTable routingTable = routingTableBuilder.build(); RoutingTable routingTable = routingTableBuilder.build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build(); ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();
@ -340,7 +338,7 @@ public class SingleShardNoReplicasRoutingTests {
RoutingTable.Builder routingTableBuilder = routingTable(); RoutingTable.Builder routingTableBuilder = routingTable();
for (int i = 0; i < numberOfIndices; i++) { for (int i = 0; i < numberOfIndices; i++) {
routingTableBuilder.add(indexRoutingTable("test" + i).initializeEmpty(metaData.index("test" + i))); routingTableBuilder.addAsNew(metaData.index("test" + i));
} }
RoutingTable routingTable = routingTableBuilder.build(); RoutingTable routingTable = routingTableBuilder.build();

View File

@ -32,11 +32,10 @@ import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder; import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder; import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder;
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder; 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.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.*; 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.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.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.nullValue; import static org.hamcrest.Matchers.nullValue;
@ -59,7 +58,7 @@ public class SingleShardOneReplicaRoutingTests {
.build(); .build();
RoutingTable routingTable = routingTable() RoutingTable routingTable = routingTable()
.add(indexRoutingTable("test").initializeEmpty(metaData.index("test"))) .addAsNew(metaData.index("test"))
.build(); .build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build(); ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();

View File

@ -32,11 +32,10 @@ import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder; import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder; import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder;
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder; 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.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.*; 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.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.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.*; import static org.hamcrest.Matchers.*;
@ -63,7 +62,7 @@ public class TenShardsOneReplicaRoutingTests {
.build(); .build();
RoutingTable routingTable = routingTable() RoutingTable routingTable = routingTable()
.add(indexRoutingTable("test").initializeEmpty(metaData.index("test"))) .addAsNew(metaData.index("test"))
.build(); .build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build(); ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();

View File

@ -31,10 +31,8 @@ import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder; import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder; import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder;
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder; 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.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.*; 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.common.settings.ImmutableSettings.settingsBuilder;
import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
@ -60,7 +58,7 @@ public class ThrottlingAllocationTests {
.build(); .build();
RoutingTable routingTable = routingTable() RoutingTable routingTable = routingTable()
.add(indexRoutingTable("test").initializeEmpty(metaData.index("test"))) .addAsNew(metaData.index("test"))
.build(); .build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build(); ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();
@ -121,7 +119,7 @@ public class ThrottlingAllocationTests {
.build(); .build();
RoutingTable routingTable = routingTable() RoutingTable routingTable = routingTable()
.add(indexRoutingTable("test").initializeEmpty(metaData.index("test"))) .addAsNew(metaData.index("test"))
.build(); .build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build(); ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();

View File

@ -13,11 +13,10 @@ import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder; import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder; import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder;
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder; 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.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.*; 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.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.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.*; import static org.hamcrest.Matchers.*;
@ -39,7 +38,7 @@ public class UpdateNumberOfReplicasTests {
.build(); .build();
RoutingTable routingTable = routingTable() RoutingTable routingTable = routingTable()
.add(indexRoutingTable("test").initializeEmpty(metaData.index("test"))) .addAsNew(metaData.index("test"))
.build(); .build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build(); ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();

View File

@ -33,7 +33,6 @@ import org.testng.annotations.Test;
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder; import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder; import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder; import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder;
import static org.elasticsearch.cluster.routing.RoutingBuilders.indexRoutingTable;
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable; import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
@ -50,7 +49,7 @@ public class ClusterSerializationTests {
.build(); .build();
RoutingTable routingTable = routingTable() RoutingTable routingTable = routingTable()
.add(indexRoutingTable("test").initializeEmpty(metaData.index("test"))) .addAsNew(metaData.index("test"))
.build(); .build();
DiscoveryNodes nodes = DiscoveryNodes.newNodesBuilder().put(newNode("node1")).put(newNode("node2")).put(newNode("node3")).localNodeId("node1").masterNodeId("node2").build(); DiscoveryNodes nodes = DiscoveryNodes.newNodesBuilder().put(newNode("node1")).put(newNode("node2")).put(newNode("node3")).localNodeId("node1").masterNodeId("node2").build();
@ -73,7 +72,7 @@ public class ClusterSerializationTests {
.build(); .build();
RoutingTable routingTable = routingTable() RoutingTable routingTable = routingTable()
.add(indexRoutingTable("test").initializeEmpty(metaData.index("test"))) .addAsNew(metaData.index("test"))
.build(); .build();
DiscoveryNodes nodes = DiscoveryNodes.newNodesBuilder().put(newNode("node1")).put(newNode("node2")).put(newNode("node3")).build(); DiscoveryNodes nodes = DiscoveryNodes.newNodesBuilder().put(newNode("node1")).put(newNode("node2")).put(newNode("node3")).build();

View File

@ -37,7 +37,6 @@ import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder; import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder; import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder;
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder; 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.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
@ -92,7 +91,7 @@ public class RoutingIteratorTests {
.put(newIndexMetaDataBuilder("test1").numberOfShards(1).numberOfReplicas(2)) .put(newIndexMetaDataBuilder("test1").numberOfShards(1).numberOfReplicas(2))
.build(); .build();
RoutingTable routingTable = routingTable() RoutingTable routingTable = routingTable()
.add(indexRoutingTable("test1").initializeEmpty(metaData.index("test1"))) .addAsNew(metaData.index("test1"))
.build(); .build();
ShardIterator shardIterator = routingTable.index("test1").shard(0).shardsIt(0); ShardIterator shardIterator = routingTable.index("test1").shard(0).shardsIt(0);
@ -128,8 +127,8 @@ public class RoutingIteratorTests {
.build(); .build();
RoutingTable routingTable = routingTable() RoutingTable routingTable = routingTable()
.add(indexRoutingTable("test1").initializeEmpty(metaData.index("test1"))) .addAsNew(metaData.index("test1"))
.add(indexRoutingTable("test2").initializeEmpty(metaData.index("test2"))) .addAsNew(metaData.index("test2"))
.build(); .build();
ShardIterator shardIterator = routingTable.index("test1").shard(0).shardsIt(0); ShardIterator shardIterator = routingTable.index("test1").shard(0).shardsIt(0);
@ -231,8 +230,8 @@ public class RoutingIteratorTests {
.build(); .build();
RoutingTable routingTable = routingTable() RoutingTable routingTable = routingTable()
.add(indexRoutingTable("test1").initializeEmpty(metaData.index("test1"))) .addAsNew(metaData.index("test1"))
.add(indexRoutingTable("test2").initializeEmpty(metaData.index("test2"))) .addAsNew(metaData.index("test2"))
.build(); .build();
ShardIterator shardIterator = routingTable.index("test1").shard(0).shardsRandomIt(); ShardIterator shardIterator = routingTable.index("test1").shard(0).shardsRandomIt();
@ -264,7 +263,7 @@ public class RoutingIteratorTests {
.build(); .build();
RoutingTable routingTable = routingTable() RoutingTable routingTable = routingTable()
.add(indexRoutingTable("test").initializeEmpty(metaData.index("test"))) .addAsNew(metaData.index("test"))
.build(); .build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build(); ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();
@ -313,7 +312,7 @@ public class RoutingIteratorTests {
.build(); .build();
RoutingTable routingTable = routingTable() RoutingTable routingTable = routingTable()
.add(indexRoutingTable("test").initializeEmpty(metaData.index("test"))) .addAsNew(metaData.index("test"))
.build(); .build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build(); ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();