cleanup RoutingTable#Builder construction

have a better method name, and only allow to create a copy of the builder based on existing routing table when constructing the builder
This commit is contained in:
Shay Banon 2013-11-02 01:27:51 +01:00
parent d111e169a4
commit fef647cb92
41 changed files with 103 additions and 174 deletions

View File

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

View File

@ -122,7 +122,7 @@ public class MetaDataDeleteIndexService extends AbstractComponent {
logger.info("[{}] deleting index", request.index);
RoutingTable.Builder routingTableBuilder = RoutingTable.builder().routingTable(currentState.routingTable());
RoutingTable.Builder routingTableBuilder = RoutingTable.builder(currentState.routingTable());
routingTableBuilder.remove(request.index);
MetaData newMetaData = MetaData.builder(currentState.metaData())

View File

@ -123,8 +123,7 @@ public class MetaDataIndexStateService extends AbstractComponent {
ClusterState updatedState = ClusterState.builder().state(currentState).metaData(mdBuilder).blocks(blocksBuilder).build();
RoutingTable.Builder rtBuilder = RoutingTable.builder()
.routingTable(currentState.routingTable());
RoutingTable.Builder rtBuilder = RoutingTable.builder(currentState.routingTable());
for (String index : indicesToClose) {
rtBuilder.remove(index);
}
@ -194,8 +193,7 @@ public class MetaDataIndexStateService extends AbstractComponent {
ClusterState updatedState = ClusterState.builder().state(currentState).metaData(mdBuilder).blocks(blocksBuilder).build();
RoutingTable.Builder rtBuilder = RoutingTable.builder()
.routingTable(updatedState.routingTable());
RoutingTable.Builder rtBuilder = RoutingTable.builder(updatedState.routingTable());
for (String index : indicesToOpen) {
rtBuilder.addAsRecovery(updatedState.metaData().index(index));
}

View File

@ -231,7 +231,7 @@ public class MetaDataUpdateSettingsService extends AbstractComponent implements
@Override
public ClusterState execute(ClusterState currentState) {
String[] actualIndices = currentState.metaData().concreteIndices(request.indices());
RoutingTable.Builder routingTableBuilder = RoutingTable.builder().routingTable(currentState.routingTable());
RoutingTable.Builder routingTableBuilder = RoutingTable.builder(currentState.routingTable());
MetaData.Builder metaDataBuilder = MetaData.builder(currentState.metaData());
// allow to change any settings to a close index, and only allow dynamic settings to be changed

View File

@ -300,10 +300,13 @@ public class IndexRoutingTable implements Iterable<IndexShardRoutingTable> {
public void validate() throws RoutingValidationException {
}
public Builder builder(String index) {
return new Builder(index);
}
public static class Builder {
private final String index;
private final Map<Integer, IndexShardRoutingTable> shards = new HashMap<Integer, IndexShardRoutingTable>();
public Builder(String index) {

View File

@ -1,47 +0,0 @@
/*
* Licensed to Elastic Search and Shay Banon under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. Elastic Search licenses this
* file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.cluster.routing;
/**
* Convenience class that provides access to {@link RoutingTable.Builder} and
* {@link IndexRoutingTable.Builder}. These builder classes should be used to
* build {@link RoutingTable} and {@link IndexRoutingTable} instances,
* repectively.
*/
public final class RoutingBuilders {
private RoutingBuilders() {
//no instance
}
/**
* Returns a new {@link RoutingTable.Builder} instance
*/
public static RoutingTable.Builder routingTable() {
return new RoutingTable.Builder();
}
/**
* Returns a new {@link IndexRoutingTable.Builder} instance
*/
public static IndexRoutingTable.Builder indexRoutingTable(String index) {
return new IndexRoutingTable.Builder(index);
}
}

View File

@ -262,18 +262,24 @@ public class RoutingTable implements Iterable<IndexRoutingTable> {
return new Builder();
}
public static Builder builder(RoutingTable routingTable) {
return new Builder(routingTable);
}
public static class Builder {
private long version;
private final Map<String, IndexRoutingTable> indicesRouting = newHashMap();
public Builder routingTable(RoutingTable routingTable) {
public Builder() {
}
public Builder(RoutingTable routingTable) {
version = routingTable.version;
for (IndexRoutingTable indexRoutingTable : routingTable) {
indicesRouting.put(indexRoutingTable.index(), indexRoutingTable);
}
return this;
}
public Builder updateNodes(RoutingNodes routingNodes) {

View File

@ -327,7 +327,7 @@ public class InternalClusterService extends AbstractLifecycleComponent<ClusterSe
// only the master controls the version numbers
Builder builder = ClusterState.builder().state(newClusterState).version(newClusterState.version() + 1);
if (previousClusterState.routingTable() != newClusterState.routingTable()) {
builder.routingTable(RoutingTable.builder().routingTable(newClusterState.routingTable()).version(newClusterState.routingTable().version() + 1));
builder.routingTable(RoutingTable.builder(newClusterState.routingTable()).version(newClusterState.routingTable().version() + 1));
}
if (previousClusterState.metaData() != newClusterState.metaData()) {
builder.metaData(MetaData.builder(newClusterState.metaData()).version(newClusterState.metaData().version() + 1));
@ -355,7 +355,7 @@ public class InternalClusterService extends AbstractLifecycleComponent<ClusterSe
// force an update, its a fresh update from the master as we transition from a start of not having a master to having one
// have a fresh instances of routing and metadata to remove the chance that version might be the same
Builder builder = ClusterState.builder().state(newClusterState);
builder.routingTable(RoutingTable.builder().routingTable(newClusterState.routingTable()));
builder.routingTable(RoutingTable.builder(newClusterState.routingTable()));
builder.metaData(MetaData.builder(newClusterState.metaData()));
newClusterState = builder.build();
logger.debug("got first state from fresh master [{}]", newClusterState.nodes().masterNodeId());

View File

@ -265,7 +265,7 @@ public class GatewayService extends AbstractLifecycleComponent<GatewayService> i
.build();
// initialize all index routing tables as empty
RoutingTable.Builder routingTableBuilder = RoutingTable.builder().routingTable(updatedState.routingTable());
RoutingTable.Builder routingTableBuilder = RoutingTable.builder(updatedState.routingTable());
for (IndexMetaData indexMetaData : updatedState.metaData().indices().values()) {
routingTableBuilder.addAsRecovery(indexMetaData);
}

View File

@ -122,7 +122,7 @@ public class LocalAllocateDangledIndices extends AbstractComponent {
}
MetaData.Builder metaData = MetaData.builder(currentState.metaData());
ClusterBlocks.Builder blocks = ClusterBlocks.builder().blocks(currentState.blocks());
RoutingTable.Builder routingTableBuilder = RoutingTable.builder().routingTable(currentState.routingTable());
RoutingTable.Builder routingTableBuilder = RoutingTable.builder(currentState.routingTable());
boolean importNeeded = false;
StringBuilder sb = new StringBuilder();

View File

@ -20,7 +20,6 @@ import org.junit.Test;
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
@ -270,7 +269,7 @@ public class AddIncrementallyTests extends ElasticsearchTestCase {
private ClusterState initCluster(AllocationService service, int numberOfNodes, int numberOfIndices, int numberOfShards,
int numberOfReplicas) {
MetaData.Builder metaDataBuilder = MetaData.builder();
RoutingTable.Builder routingTableBuilder = routingTable();
RoutingTable.Builder routingTableBuilder = RoutingTable.builder();
for (int i = 0; i < numberOfIndices; i++) {
IndexMetaData.Builder index = newIndexMetaDataBuilder("test" + i).numberOfShards(numberOfShards).numberOfReplicas(
@ -325,7 +324,7 @@ public class AddIncrementallyTests extends ElasticsearchTestCase {
private ClusterState addIndex(ClusterState clusterState, AllocationService service, int indexOrdinal, int numberOfShards,
int numberOfReplicas) {
MetaData.Builder metaDataBuilder = MetaData.builder(clusterState.getMetaData());
RoutingTable.Builder routingTableBuilder = routingTable().routingTable(clusterState.routingTable());
RoutingTable.Builder routingTableBuilder = RoutingTable.builder(clusterState.routingTable());
IndexMetaData.Builder index = newIndexMetaDataBuilder("test" + indexOrdinal).numberOfShards(numberOfShards).numberOfReplicas(
numberOfReplicas);

View File

@ -30,7 +30,6 @@ import org.junit.Test;
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
@ -50,7 +49,7 @@ public class AllocatePostApiFlagTests extends ElasticsearchTestCase {
MetaData metaData = MetaData.builder()
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(0))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test"))
.build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();

View File

@ -43,7 +43,6 @@ import org.junit.Test;
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
@ -64,7 +63,7 @@ public class AllocationCommandsTests extends ElasticsearchTestCase {
MetaData metaData = MetaData.builder()
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(0))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test"))
.build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();
@ -111,7 +110,7 @@ public class AllocationCommandsTests extends ElasticsearchTestCase {
MetaData metaData = MetaData.builder()
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test"))
.build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();
@ -192,7 +191,7 @@ public class AllocationCommandsTests extends ElasticsearchTestCase {
MetaData metaData = MetaData.builder()
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test"))
.build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();

View File

@ -33,7 +33,6 @@ import org.junit.Test;
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.*;
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
@ -59,7 +58,7 @@ public class AwarenessAllocationTests extends ElasticsearchTestCase {
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test"))
.build();
@ -128,7 +127,7 @@ public class AwarenessAllocationTests extends ElasticsearchTestCase {
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test"))
.build();
@ -203,7 +202,7 @@ public class AwarenessAllocationTests extends ElasticsearchTestCase {
.put(newIndexMetaDataBuilder("test").numberOfShards(5).numberOfReplicas(1))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test"))
.build();
@ -302,7 +301,7 @@ public class AwarenessAllocationTests extends ElasticsearchTestCase {
.put(newIndexMetaDataBuilder("test2").numberOfShards(5).numberOfReplicas(1))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test1"))
.addAsNew(metaData.index("test2"))
.build();
@ -395,7 +394,7 @@ public class AwarenessAllocationTests extends ElasticsearchTestCase {
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(2))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test"))
.build();
@ -474,7 +473,7 @@ public class AwarenessAllocationTests extends ElasticsearchTestCase {
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(3))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test"))
.build();
@ -556,7 +555,7 @@ public class AwarenessAllocationTests extends ElasticsearchTestCase {
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test"))
.build();
@ -624,7 +623,7 @@ public class AwarenessAllocationTests extends ElasticsearchTestCase {
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test"))
.build();
@ -699,7 +698,7 @@ public class AwarenessAllocationTests extends ElasticsearchTestCase {
.put(newIndexMetaDataBuilder("test2").numberOfShards(5).numberOfReplicas(1))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test1"))
.addAsNew(metaData.index("test2"))
.build();
@ -780,7 +779,7 @@ public class AwarenessAllocationTests extends ElasticsearchTestCase {
.put(newIndexMetaDataBuilder("test").numberOfShards(5).numberOfReplicas(1))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test"))
.build();

View File

@ -45,7 +45,6 @@ import java.util.List;
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
@ -145,7 +144,7 @@ public class BalanceConfigurationTests extends ElasticsearchTestCase {
private ClusterState initCluster(AllocationService strategy) {
MetaData.Builder metaDataBuilder = MetaData.builder();
RoutingTable.Builder routingTableBuilder = routingTable();
RoutingTable.Builder routingTableBuilder = RoutingTable.builder();
for (int i = 0; i < numberOfIndices; i++) {
IndexMetaData.Builder index = newIndexMetaDataBuilder("test" + i).numberOfShards(numberOfShards).numberOfReplicas(numberOfReplicas);
@ -453,7 +452,7 @@ public class BalanceConfigurationTests extends ElasticsearchTestCase {
}
}), ClusterInfoService.EMPTY);
MetaData.Builder metaDataBuilder = MetaData.builder();
RoutingTable.Builder routingTableBuilder = routingTable();
RoutingTable.Builder routingTableBuilder = RoutingTable.builder();
IndexMetaData.Builder indexMeta = newIndexMetaDataBuilder("test").numberOfShards(5).numberOfReplicas(1);
metaDataBuilder = metaDataBuilder.put(indexMeta);
MetaData metaData = metaDataBuilder.build();

View File

@ -32,7 +32,6 @@ import org.junit.Test;
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.*;
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
@ -51,7 +50,7 @@ public class ClusterRebalanceRoutingTests extends ElasticsearchTestCase {
.put(newIndexMetaDataBuilder("test2").numberOfShards(1).numberOfReplicas(1))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test1"))
.addAsNew(metaData.index("test2"))
.build();
@ -137,7 +136,7 @@ public class ClusterRebalanceRoutingTests extends ElasticsearchTestCase {
.put(newIndexMetaDataBuilder("test2").numberOfShards(1).numberOfReplicas(1))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test1"))
.addAsNew(metaData.index("test2"))
.build();
@ -241,7 +240,7 @@ public class ClusterRebalanceRoutingTests extends ElasticsearchTestCase {
.put(newIndexMetaDataBuilder("test2").numberOfShards(1).numberOfReplicas(1))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test1"))
.addAsNew(metaData.index("test2"))
.build();
@ -325,7 +324,7 @@ public class ClusterRebalanceRoutingTests extends ElasticsearchTestCase {
.put(newIndexMetaDataBuilder("test2").numberOfShards(1).numberOfReplicas(1))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test1"))
.addAsNew(metaData.index("test2"))
.build();
@ -448,7 +447,7 @@ public class ClusterRebalanceRoutingTests extends ElasticsearchTestCase {
.put(newIndexMetaDataBuilder("test2").numberOfShards(1).numberOfReplicas(1))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test1"))
.addAsNew(metaData.index("test2"))
.build();
@ -532,7 +531,7 @@ public class ClusterRebalanceRoutingTests extends ElasticsearchTestCase {
.put(newIndexMetaDataBuilder("test2").numberOfShards(1).numberOfReplicas(1))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test1"))
.addAsNew(metaData.index("test2"))
.build();

View File

@ -31,7 +31,6 @@ import org.junit.Test;
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.*;
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
@ -55,7 +54,7 @@ public class ConcurrentRebalanceRoutingTests extends ElasticsearchTestCase {
.put(newIndexMetaDataBuilder("test").numberOfShards(5).numberOfReplicas(1))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test"))
.build();

View File

@ -32,7 +32,6 @@ import org.junit.Test;
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.*;
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
@ -55,7 +54,7 @@ public class DeadNodesAllocationTests extends ElasticsearchTestCase {
MetaData metaData = MetaData.builder()
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test"))
.build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();
@ -107,7 +106,7 @@ public class DeadNodesAllocationTests extends ElasticsearchTestCase {
MetaData metaData = MetaData.builder()
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test"))
.build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();
@ -182,7 +181,7 @@ public class DeadNodesAllocationTests extends ElasticsearchTestCase {
MetaData metaData = MetaData.builder()
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test"))
.build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();

View File

@ -32,7 +32,6 @@ import org.junit.Test;
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
@ -58,7 +57,7 @@ public class DisableAllocationTests extends ElasticsearchTestCase {
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test"))
.build();
@ -87,7 +86,7 @@ public class DisableAllocationTests extends ElasticsearchTestCase {
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test"))
.build();
@ -119,7 +118,7 @@ public class DisableAllocationTests extends ElasticsearchTestCase {
.put(newIndexMetaDataBuilder("enabled").numberOfShards(1).numberOfReplicas(1))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("disabled"))
.addAsNew(metaData.index("enabled"))
.build();

View File

@ -32,7 +32,6 @@ import org.junit.Test;
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
@ -56,7 +55,7 @@ public class ElectReplicaAsPrimaryDuringRelocationTests extends ElasticsearchTes
.put(newIndexMetaDataBuilder("test").numberOfShards(2).numberOfReplicas(1))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test"))
.build();

View File

@ -33,7 +33,6 @@ import org.junit.Test;
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
@ -53,7 +52,7 @@ public class FailedNodeRoutingTests extends ElasticsearchTestCase {
.put(newIndexMetaDataBuilder("test2").numberOfShards(1).numberOfReplicas(1))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test1"))
.addAsNew(metaData.index("test2"))
.build();
@ -113,7 +112,7 @@ public class FailedNodeRoutingTests extends ElasticsearchTestCase {
.put(newIndexMetaDataBuilder("test2").numberOfShards(1).numberOfReplicas(1))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test1"))
.addAsNew(metaData.index("test2"))
.build();

View File

@ -35,7 +35,6 @@ import org.junit.Test;
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.*;
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
@ -59,7 +58,7 @@ public class FailedShardsRoutingTests extends ElasticsearchTestCase {
MetaData metaData = MetaData.builder()
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test"))
.build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();
@ -150,7 +149,7 @@ public class FailedShardsRoutingTests extends ElasticsearchTestCase {
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test"))
.build();
@ -231,7 +230,7 @@ public class FailedShardsRoutingTests extends ElasticsearchTestCase {
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test"))
.build();
@ -288,7 +287,7 @@ public class FailedShardsRoutingTests extends ElasticsearchTestCase {
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test"))
.build();
@ -345,7 +344,7 @@ public class FailedShardsRoutingTests extends ElasticsearchTestCase {
.put(newIndexMetaDataBuilder("test").numberOfShards(2).numberOfReplicas(1))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test"))
.build();

View File

@ -36,7 +36,6 @@ import java.util.List;
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
@ -61,7 +60,7 @@ public class FilterRoutingTests extends ElasticsearchTestCase {
.put(newIndexMetaDataBuilder("test").numberOfShards(2).numberOfReplicas(1))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test"))
.build();
@ -110,7 +109,7 @@ public class FilterRoutingTests extends ElasticsearchTestCase {
.build()))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test"))
.build();

View File

@ -33,7 +33,6 @@ import org.junit.Test;
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.*;
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
@ -60,7 +59,7 @@ public class IndexBalanceTests extends ElasticsearchTestCase {
MetaData metaData = MetaData.builder().put(newIndexMetaDataBuilder("test").numberOfShards(3).numberOfReplicas(1))
.put(newIndexMetaDataBuilder("test1").numberOfShards(3).numberOfReplicas(1)).build();
RoutingTable routingTable = routingTable().addAsNew(metaData.index("test")).addAsNew(metaData.index("test1")).build();
RoutingTable routingTable = RoutingTable.builder().addAsNew(metaData.index("test")).addAsNew(metaData.index("test1")).build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();
@ -191,7 +190,7 @@ public class IndexBalanceTests extends ElasticsearchTestCase {
MetaData metaData = MetaData.builder().put(newIndexMetaDataBuilder("test").numberOfShards(3).numberOfReplicas(1))
.put(newIndexMetaDataBuilder("test1").numberOfShards(3).numberOfReplicas(1)).build();
RoutingTable routingTable = routingTable().addAsNew(metaData.index("test")).addAsNew(metaData.index("test1")).build();
RoutingTable routingTable = RoutingTable.builder().addAsNew(metaData.index("test")).addAsNew(metaData.index("test1")).build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();
@ -353,7 +352,7 @@ public class IndexBalanceTests extends ElasticsearchTestCase {
MetaData metaData = MetaData.builder().put(newIndexMetaDataBuilder("test").numberOfShards(3).numberOfReplicas(1)).build();
RoutingTable routingTable = routingTable().addAsNew(metaData.index("test")).build();
RoutingTable routingTable = RoutingTable.builder().addAsNew(metaData.index("test")).build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();
@ -455,7 +454,7 @@ public class IndexBalanceTests extends ElasticsearchTestCase {
.put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 1)
))
.build();
routingTable = routingTable().routingTable(routingTable)
routingTable = RoutingTable.builder(routingTable)
.addAsNew(metaData.index("test1"))
.build();
clusterState = newClusterStateBuilder().state(clusterState).metaData(metaData).routingTable(routingTable).build();

View File

@ -30,7 +30,6 @@ import org.junit.Test;
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
@ -57,7 +56,7 @@ public class PreferPrimaryAllocationTests extends ElasticsearchTestCase {
.put(newIndexMetaDataBuilder("test2").numberOfShards(10).numberOfReplicas(0))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test1"))
.addAsNew(metaData.index("test2"))
.build();
@ -75,7 +74,7 @@ public class PreferPrimaryAllocationTests extends ElasticsearchTestCase {
}
logger.info("increasing the number of replicas to 1, and perform a reroute (to get the replicas allocation going)");
routingTable = RoutingTable.builder().routingTable(routingTable).updateNumberOfReplicas(1).build();
routingTable = RoutingTable.builder(routingTable).updateNumberOfReplicas(1).build();
metaData = MetaData.builder(clusterState.metaData()).updateNumberOfReplicas(1).build();
clusterState = newClusterStateBuilder().state(clusterState).routingTable(routingTable).metaData(metaData).build();
@ -90,7 +89,7 @@ public class PreferPrimaryAllocationTests extends ElasticsearchTestCase {
.put(newIndexMetaDataBuilder("new_index").numberOfShards(4).numberOfReplicas(0))
.build();
routingTable = routingTable().routingTable(clusterState.routingTable())
routingTable = RoutingTable.builder(clusterState.routingTable())
.addAsNew(metaData.index("new_index"))
.build();

View File

@ -31,7 +31,6 @@ import org.junit.Test;
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
@ -56,7 +55,7 @@ public class PrimaryElectionRoutingTests extends ElasticsearchTestCase {
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test"))
.build();
@ -107,7 +106,7 @@ public class PrimaryElectionRoutingTests extends ElasticsearchTestCase {
.put(newIndexMetaDataBuilder("test").numberOfShards(2).numberOfReplicas(1))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test"))
.build();

View File

@ -31,7 +31,6 @@ import org.junit.Test;
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
@ -59,7 +58,7 @@ public class PrimaryNotRelocatedWhileBeingRecoveredTests extends ElasticsearchTe
.put(newIndexMetaDataBuilder("test").numberOfShards(5).numberOfReplicas(1))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test"))
.build();

View File

@ -45,7 +45,6 @@ import java.util.Random;
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
@ -77,7 +76,7 @@ public class RandomAllocationDeciderTests extends ElasticsearchTestCase {
}
MetaData metaData = metaBuilder.build();
RoutingTable.Builder routingTableBuilder = routingTable();
RoutingTable.Builder routingTableBuilder = RoutingTable.builder();
for (int i = 0; i < indices; i++) {
routingTableBuilder.addAsNew(metaData.index("INDEX_" + i));
}

View File

@ -32,7 +32,6 @@ import org.junit.Test;
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.*;
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
@ -60,7 +59,7 @@ public class RebalanceAfterActiveTests extends ElasticsearchTestCase {
.put(newIndexMetaDataBuilder("test").numberOfShards(5).numberOfReplicas(1))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test"))
.build();

View File

@ -31,7 +31,6 @@ import org.junit.Test;
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.*;
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
@ -55,7 +54,7 @@ public class ReplicaAllocatedAfterPrimaryTests extends ElasticsearchTestCase {
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test"))
.build();

View File

@ -15,7 +15,6 @@ import org.junit.Test;
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
@ -35,7 +34,7 @@ public class SameShardRoutingTests extends ElasticsearchTestCase {
.put(newIndexMetaDataBuilder("test").numberOfShards(2).numberOfReplicas(1))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test"))
.build();
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();

View File

@ -32,7 +32,6 @@ import org.junit.Test;
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.*;
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
@ -51,7 +50,7 @@ public class ShardVersioningTests extends ElasticsearchTestCase {
.put(newIndexMetaDataBuilder("test2").numberOfShards(1).numberOfReplicas(1))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test1"))
.addAsNew(metaData.index("test2"))
.build();

View File

@ -36,7 +36,6 @@ import org.junit.Test;
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.*;
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
@ -61,7 +60,7 @@ public class ShardsLimitAllocationTests extends ElasticsearchTestCase {
.put(ShardsLimitAllocationDecider.INDEX_TOTAL_SHARDS_PER_NODE, 2)))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test"))
.build();
@ -111,7 +110,7 @@ public class ShardsLimitAllocationTests extends ElasticsearchTestCase {
))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test"))
.build();
@ -135,7 +134,7 @@ public class ShardsLimitAllocationTests extends ElasticsearchTestCase {
.put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0)
))
.build();
routingTable = routingTable().routingTable(routingTable)
routingTable = RoutingTable.builder(routingTable)
.addAsNew(metaData.index("test1"))
.build();

View File

@ -40,7 +40,6 @@ import static com.google.common.collect.Sets.newHashSet;
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.*;
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
@ -63,7 +62,7 @@ public class SingleShardNoReplicasRoutingTests extends ElasticsearchTestCase {
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(0))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test"))
.build();
@ -165,7 +164,7 @@ public class SingleShardNoReplicasRoutingTests extends ElasticsearchTestCase {
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(0))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test"))
.build();
@ -222,7 +221,7 @@ public class SingleShardNoReplicasRoutingTests extends ElasticsearchTestCase {
}
MetaData metaData = metaDataBuilder.build();
RoutingTable.Builder routingTableBuilder = routingTable();
RoutingTable.Builder routingTableBuilder = RoutingTable.builder();
for (int i = 0; i < numberOfIndices; i++) {
routingTableBuilder.addAsNew(metaData.index("test" + i));
}
@ -335,7 +334,7 @@ public class SingleShardNoReplicasRoutingTests extends ElasticsearchTestCase {
}
MetaData metaData = metaDataBuilder.build();
RoutingTable.Builder routingTableBuilder = routingTable();
RoutingTable.Builder routingTableBuilder = RoutingTable.builder();
for (int i = 0; i < numberOfIndices; i++) {
routingTableBuilder.addAsNew(metaData.index("test" + i));
}

View File

@ -31,7 +31,6 @@ import org.junit.Test;
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.*;
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
@ -55,7 +54,7 @@ public class SingleShardOneReplicaRoutingTests extends ElasticsearchTestCase {
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test"))
.build();

View File

@ -31,7 +31,6 @@ import org.junit.Test;
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.*;
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
@ -62,7 +61,7 @@ public class TenShardsOneReplicaRoutingTests extends ElasticsearchTestCase {
.put(newIndexMetaDataBuilder("test").numberOfShards(10).numberOfReplicas(1))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test"))
.build();

View File

@ -30,7 +30,6 @@ import org.junit.Test;
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.*;
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
@ -56,7 +55,7 @@ public class ThrottlingAllocationTests extends ElasticsearchTestCase {
.put(newIndexMetaDataBuilder("test").numberOfShards(10).numberOfReplicas(1))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test"))
.build();
@ -117,7 +116,7 @@ public class ThrottlingAllocationTests extends ElasticsearchTestCase {
.put(newIndexMetaDataBuilder("test").numberOfShards(5).numberOfReplicas(1))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test"))
.build();

View File

@ -12,7 +12,6 @@ import org.junit.Test;
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.*;
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
@ -35,7 +34,7 @@ public class UpdateNumberOfReplicasTests extends ElasticsearchTestCase {
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test"))
.build();
@ -82,7 +81,7 @@ public class UpdateNumberOfReplicasTests extends ElasticsearchTestCase {
logger.info("add another replica");
routingNodes = clusterState.routingNodes();
prevRoutingTable = routingTable;
routingTable = RoutingTable.builder().routingTable(routingTable).updateNumberOfReplicas(2).build();
routingTable = RoutingTable.builder(routingTable).updateNumberOfReplicas(2).build();
metaData = MetaData.builder(clusterState.metaData()).updateNumberOfReplicas(2).build();
clusterState = newClusterStateBuilder().state(clusterState).routingTable(routingTable).metaData(metaData).build();
@ -134,7 +133,7 @@ public class UpdateNumberOfReplicasTests extends ElasticsearchTestCase {
logger.info("now remove a replica");
routingNodes = clusterState.routingNodes();
prevRoutingTable = routingTable;
routingTable = RoutingTable.builder().routingTable(routingTable).updateNumberOfReplicas(1).build();
routingTable = RoutingTable.builder(routingTable).updateNumberOfReplicas(1).build();
metaData = MetaData.builder(clusterState.metaData()).updateNumberOfReplicas(1).build();
clusterState = newClusterStateBuilder().state(clusterState).routingTable(routingTable).metaData(metaData).build();

View File

@ -42,7 +42,6 @@ import java.util.Map;
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.*;
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
@ -91,7 +90,7 @@ public class DiskThresholdDeciderTests extends ElasticsearchTestCase {
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test"))
.build();
@ -280,7 +279,7 @@ public class DiskThresholdDeciderTests extends ElasticsearchTestCase {
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test"))
.build();
@ -466,7 +465,7 @@ public class DiskThresholdDeciderTests extends ElasticsearchTestCase {
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(0))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test"))
.build();
@ -528,7 +527,7 @@ public class DiskThresholdDeciderTests extends ElasticsearchTestCase {
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(0))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test"))
.build();

View File

@ -34,7 +34,6 @@ import org.junit.Test;
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
import static org.hamcrest.Matchers.equalTo;
/**
@ -48,7 +47,7 @@ public class ClusterSerializationTests extends ElasticsearchTestCase {
.put(newIndexMetaDataBuilder("test").numberOfShards(10).numberOfReplicas(1))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test"))
.build();
@ -71,7 +70,7 @@ public class ClusterSerializationTests extends ElasticsearchTestCase {
.put(newIndexMetaDataBuilder("test").numberOfShards(10).numberOfReplicas(1))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test"))
.build();

View File

@ -36,7 +36,6 @@ import org.junit.Test;
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
@ -88,7 +87,7 @@ public class RoutingIteratorTests extends ElasticsearchTestCase {
MetaData metaData = MetaData.builder()
.put(newIndexMetaDataBuilder("test1").numberOfShards(1).numberOfReplicas(2))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test1"))
.build();
@ -124,7 +123,7 @@ public class RoutingIteratorTests extends ElasticsearchTestCase {
.put(newIndexMetaDataBuilder("test2").numberOfShards(1).numberOfReplicas(1))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test1"))
.addAsNew(metaData.index("test2"))
.build();
@ -227,7 +226,7 @@ public class RoutingIteratorTests extends ElasticsearchTestCase {
.put(newIndexMetaDataBuilder("test2").numberOfShards(1).numberOfReplicas(1))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test1"))
.addAsNew(metaData.index("test2"))
.build();
@ -260,7 +259,7 @@ public class RoutingIteratorTests extends ElasticsearchTestCase {
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test"))
.build();
@ -309,7 +308,7 @@ public class RoutingIteratorTests extends ElasticsearchTestCase {
.put(newIndexMetaDataBuilder("test").numberOfShards(5).numberOfReplicas(1))
.build();
RoutingTable routingTable = routingTable()
RoutingTable routingTable = RoutingTable.builder()
.addAsNew(metaData.index("test"))
.build();