From fef647cb92926c97107f506831bfbdc0b838e80c Mon Sep 17 00:00:00 2001 From: Shay Banon Date: Sat, 2 Nov 2013 01:27:51 +0100 Subject: [PATCH] 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 --- .../metadata/MetaDataCreateIndexService.java | 2 +- .../metadata/MetaDataDeleteIndexService.java | 2 +- .../metadata/MetaDataIndexStateService.java | 6 +-- .../MetaDataUpdateSettingsService.java | 2 +- .../cluster/routing/IndexRoutingTable.java | 5 +- .../cluster/routing/RoutingBuilders.java | 47 ------------------- .../cluster/routing/RoutingTable.java | 12 +++-- .../service/InternalClusterService.java | 4 +- .../elasticsearch/gateway/GatewayService.java | 2 +- .../meta/LocalAllocateDangledIndices.java | 2 +- .../allocation/AddIncrementallyTests.java | 5 +- .../allocation/AllocatePostApiFlagTests.java | 3 +- .../allocation/AllocationCommandsTests.java | 7 ++- .../allocation/AwarenessAllocationTests.java | 21 ++++----- .../allocation/BalanceConfigurationTests.java | 5 +- .../ClusterRebalanceRoutingTests.java | 13 +++-- .../ConcurrentRebalanceRoutingTests.java | 3 +- .../allocation/DeadNodesAllocationTests.java | 7 ++- .../allocation/DisableAllocationTests.java | 7 ++- ...ReplicaAsPrimaryDuringRelocationTests.java | 3 +- .../allocation/FailedNodeRoutingTests.java | 5 +- .../allocation/FailedShardsRoutingTests.java | 11 ++--- .../allocation/FilterRoutingTests.java | 5 +- .../routing/allocation/IndexBalanceTests.java | 9 ++-- .../PreferPrimaryAllocationTests.java | 7 ++- .../PrimaryElectionRoutingTests.java | 5 +- ...yNotRelocatedWhileBeingRecoveredTests.java | 3 +- .../RandomAllocationDeciderTests.java | 3 +- .../allocation/RebalanceAfterActiveTests.java | 3 +- .../ReplicaAllocatedAfterPrimaryTests.java | 3 +- .../allocation/SameShardRoutingTests.java | 3 +- .../allocation/ShardVersioningTests.java | 3 +- .../ShardsLimitAllocationTests.java | 7 ++- .../SingleShardNoReplicasRoutingTests.java | 9 ++-- .../SingleShardOneReplicaRoutingTests.java | 3 +- .../TenShardsOneReplicaRoutingTests.java | 3 +- .../allocation/ThrottlingAllocationTests.java | 5 +- .../UpdateNumberOfReplicasTests.java | 7 ++- .../decider/DiskThresholdDeciderTests.java | 9 ++-- .../ClusterSerializationTests.java | 5 +- .../structure/RoutingIteratorTests.java | 11 ++--- 41 files changed, 103 insertions(+), 174 deletions(-) delete mode 100644 src/main/java/org/elasticsearch/cluster/routing/RoutingBuilders.java diff --git a/src/main/java/org/elasticsearch/cluster/metadata/MetaDataCreateIndexService.java b/src/main/java/org/elasticsearch/cluster/metadata/MetaDataCreateIndexService.java index 0322674b1b2..bdf042f39d8 100644 --- a/src/main/java/org/elasticsearch/cluster/metadata/MetaDataCreateIndexService.java +++ b/src/main/java/org/elasticsearch/cluster/metadata/MetaDataCreateIndexService.java @@ -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(); diff --git a/src/main/java/org/elasticsearch/cluster/metadata/MetaDataDeleteIndexService.java b/src/main/java/org/elasticsearch/cluster/metadata/MetaDataDeleteIndexService.java index 77a1b8ecc84..737d7fece0d 100644 --- a/src/main/java/org/elasticsearch/cluster/metadata/MetaDataDeleteIndexService.java +++ b/src/main/java/org/elasticsearch/cluster/metadata/MetaDataDeleteIndexService.java @@ -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()) diff --git a/src/main/java/org/elasticsearch/cluster/metadata/MetaDataIndexStateService.java b/src/main/java/org/elasticsearch/cluster/metadata/MetaDataIndexStateService.java index 1862baeb2ba..e92757b4e38 100644 --- a/src/main/java/org/elasticsearch/cluster/metadata/MetaDataIndexStateService.java +++ b/src/main/java/org/elasticsearch/cluster/metadata/MetaDataIndexStateService.java @@ -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)); } diff --git a/src/main/java/org/elasticsearch/cluster/metadata/MetaDataUpdateSettingsService.java b/src/main/java/org/elasticsearch/cluster/metadata/MetaDataUpdateSettingsService.java index 02738424a07..df310d2dae7 100644 --- a/src/main/java/org/elasticsearch/cluster/metadata/MetaDataUpdateSettingsService.java +++ b/src/main/java/org/elasticsearch/cluster/metadata/MetaDataUpdateSettingsService.java @@ -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 diff --git a/src/main/java/org/elasticsearch/cluster/routing/IndexRoutingTable.java b/src/main/java/org/elasticsearch/cluster/routing/IndexRoutingTable.java index 0d32f676bc9..184cdd70b9a 100644 --- a/src/main/java/org/elasticsearch/cluster/routing/IndexRoutingTable.java +++ b/src/main/java/org/elasticsearch/cluster/routing/IndexRoutingTable.java @@ -300,10 +300,13 @@ public class IndexRoutingTable implements Iterable { 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 shards = new HashMap(); public Builder(String index) { diff --git a/src/main/java/org/elasticsearch/cluster/routing/RoutingBuilders.java b/src/main/java/org/elasticsearch/cluster/routing/RoutingBuilders.java deleted file mode 100644 index 27600ddae92..00000000000 --- a/src/main/java/org/elasticsearch/cluster/routing/RoutingBuilders.java +++ /dev/null @@ -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); - } -} diff --git a/src/main/java/org/elasticsearch/cluster/routing/RoutingTable.java b/src/main/java/org/elasticsearch/cluster/routing/RoutingTable.java index 8e35db1bae7..4fac90587cf 100644 --- a/src/main/java/org/elasticsearch/cluster/routing/RoutingTable.java +++ b/src/main/java/org/elasticsearch/cluster/routing/RoutingTable.java @@ -262,18 +262,24 @@ public class RoutingTable implements Iterable { return new Builder(); } + public static Builder builder(RoutingTable routingTable) { + return new Builder(routingTable); + } + public static class Builder { private long version; - private final Map 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) { diff --git a/src/main/java/org/elasticsearch/cluster/service/InternalClusterService.java b/src/main/java/org/elasticsearch/cluster/service/InternalClusterService.java index e389a8b1e72..b1339143180 100644 --- a/src/main/java/org/elasticsearch/cluster/service/InternalClusterService.java +++ b/src/main/java/org/elasticsearch/cluster/service/InternalClusterService.java @@ -327,7 +327,7 @@ public class InternalClusterService extends AbstractLifecycleComponent 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); } diff --git a/src/main/java/org/elasticsearch/gateway/local/state/meta/LocalAllocateDangledIndices.java b/src/main/java/org/elasticsearch/gateway/local/state/meta/LocalAllocateDangledIndices.java index 5f1b0be7b5b..a2ef2110b21 100644 --- a/src/main/java/org/elasticsearch/gateway/local/state/meta/LocalAllocateDangledIndices.java +++ b/src/main/java/org/elasticsearch/gateway/local/state/meta/LocalAllocateDangledIndices.java @@ -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(); diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/AddIncrementallyTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/AddIncrementallyTests.java index e934b005998..0219636160e 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/AddIncrementallyTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/AddIncrementallyTests.java @@ -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); diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/AllocatePostApiFlagTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/AllocatePostApiFlagTests.java index 1c551c5cc6c..936331e2f82 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/AllocatePostApiFlagTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/AllocatePostApiFlagTests.java @@ -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(); diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/AllocationCommandsTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/AllocationCommandsTests.java index ce053e95120..83a8c5f50e9 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/AllocationCommandsTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/AllocationCommandsTests.java @@ -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(); diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/AwarenessAllocationTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/AwarenessAllocationTests.java index ca1280b7750..73508004f7c 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/AwarenessAllocationTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/AwarenessAllocationTests.java @@ -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(); diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/BalanceConfigurationTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/BalanceConfigurationTests.java index 36a0b3a452d..e0829b59a7c 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/BalanceConfigurationTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/BalanceConfigurationTests.java @@ -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(); diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/ClusterRebalanceRoutingTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/ClusterRebalanceRoutingTests.java index 13b0d0f8f1b..b19cc574040 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/ClusterRebalanceRoutingTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/ClusterRebalanceRoutingTests.java @@ -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(); diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/ConcurrentRebalanceRoutingTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/ConcurrentRebalanceRoutingTests.java index 4b987024326..f5f6c20b5af 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/ConcurrentRebalanceRoutingTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/ConcurrentRebalanceRoutingTests.java @@ -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(); diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/DeadNodesAllocationTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/DeadNodesAllocationTests.java index d95d486f8df..489c4996a4b 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/DeadNodesAllocationTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/DeadNodesAllocationTests.java @@ -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(); diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/DisableAllocationTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/DisableAllocationTests.java index 0ac2cbc388b..77a15441796 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/DisableAllocationTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/DisableAllocationTests.java @@ -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(); diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/ElectReplicaAsPrimaryDuringRelocationTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/ElectReplicaAsPrimaryDuringRelocationTests.java index bb01ea6f1e5..78dc5443bfa 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/ElectReplicaAsPrimaryDuringRelocationTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/ElectReplicaAsPrimaryDuringRelocationTests.java @@ -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(); diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/FailedNodeRoutingTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/FailedNodeRoutingTests.java index 51f7a6a70c2..b88524ad456 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/FailedNodeRoutingTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/FailedNodeRoutingTests.java @@ -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(); diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/FailedShardsRoutingTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/FailedShardsRoutingTests.java index 824b3194fbe..8aec09c9b5f 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/FailedShardsRoutingTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/FailedShardsRoutingTests.java @@ -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(); diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/FilterRoutingTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/FilterRoutingTests.java index 33d6592580d..6451715a637 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/FilterRoutingTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/FilterRoutingTests.java @@ -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(); diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/IndexBalanceTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/IndexBalanceTests.java index 28fbc2a165f..4a7c33b272c 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/IndexBalanceTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/IndexBalanceTests.java @@ -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(); diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/PreferPrimaryAllocationTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/PreferPrimaryAllocationTests.java index 55af56b9f80..347a59060c9 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/PreferPrimaryAllocationTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/PreferPrimaryAllocationTests.java @@ -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(); diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/PrimaryElectionRoutingTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/PrimaryElectionRoutingTests.java index b8e2ad4c350..548836d5f9e 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/PrimaryElectionRoutingTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/PrimaryElectionRoutingTests.java @@ -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(); diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/PrimaryNotRelocatedWhileBeingRecoveredTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/PrimaryNotRelocatedWhileBeingRecoveredTests.java index 853ddc7fc13..7252a99a5de 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/PrimaryNotRelocatedWhileBeingRecoveredTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/PrimaryNotRelocatedWhileBeingRecoveredTests.java @@ -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(); diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/RandomAllocationDeciderTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/RandomAllocationDeciderTests.java index ed83fd880fd..c5be41a6b67 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/RandomAllocationDeciderTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/RandomAllocationDeciderTests.java @@ -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)); } diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/RebalanceAfterActiveTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/RebalanceAfterActiveTests.java index 9b2eb0c48ef..6a4f590fd04 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/RebalanceAfterActiveTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/RebalanceAfterActiveTests.java @@ -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(); diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/ReplicaAllocatedAfterPrimaryTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/ReplicaAllocatedAfterPrimaryTests.java index bf37fcb7a0a..32b928c74e8 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/ReplicaAllocatedAfterPrimaryTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/ReplicaAllocatedAfterPrimaryTests.java @@ -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(); diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/SameShardRoutingTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/SameShardRoutingTests.java index d527e327ed2..f1701383f3d 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/SameShardRoutingTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/SameShardRoutingTests.java @@ -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(); diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/ShardVersioningTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/ShardVersioningTests.java index a28155fab7c..9d816300b5c 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/ShardVersioningTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/ShardVersioningTests.java @@ -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(); diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/ShardsLimitAllocationTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/ShardsLimitAllocationTests.java index 87f9b19bf0d..4c97e50d14b 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/ShardsLimitAllocationTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/ShardsLimitAllocationTests.java @@ -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(); diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/SingleShardNoReplicasRoutingTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/SingleShardNoReplicasRoutingTests.java index d99b762b518..5efa00f7334 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/SingleShardNoReplicasRoutingTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/SingleShardNoReplicasRoutingTests.java @@ -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)); } diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/SingleShardOneReplicaRoutingTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/SingleShardOneReplicaRoutingTests.java index efb37ad2e1f..579b0b49250 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/SingleShardOneReplicaRoutingTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/SingleShardOneReplicaRoutingTests.java @@ -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(); diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/TenShardsOneReplicaRoutingTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/TenShardsOneReplicaRoutingTests.java index b137d7230f9..5da128631c8 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/TenShardsOneReplicaRoutingTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/TenShardsOneReplicaRoutingTests.java @@ -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(); diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/ThrottlingAllocationTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/ThrottlingAllocationTests.java index a5ee6fdf3aa..575f5736860 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/ThrottlingAllocationTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/ThrottlingAllocationTests.java @@ -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(); diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/UpdateNumberOfReplicasTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/UpdateNumberOfReplicasTests.java index a1fa3f965ae..775089b475d 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/UpdateNumberOfReplicasTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/UpdateNumberOfReplicasTests.java @@ -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(); diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/DiskThresholdDeciderTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/DiskThresholdDeciderTests.java index 98eb1305e35..28f8823448d 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/DiskThresholdDeciderTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/DiskThresholdDeciderTests.java @@ -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(); diff --git a/src/test/java/org/elasticsearch/cluster/serialization/ClusterSerializationTests.java b/src/test/java/org/elasticsearch/cluster/serialization/ClusterSerializationTests.java index bd9e3c4b25d..390ddc86e1e 100644 --- a/src/test/java/org/elasticsearch/cluster/serialization/ClusterSerializationTests.java +++ b/src/test/java/org/elasticsearch/cluster/serialization/ClusterSerializationTests.java @@ -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(); diff --git a/src/test/java/org/elasticsearch/cluster/structure/RoutingIteratorTests.java b/src/test/java/org/elasticsearch/cluster/structure/RoutingIteratorTests.java index e190fb6f05f..5792944bfa6 100644 --- a/src/test/java/org/elasticsearch/cluster/structure/RoutingIteratorTests.java +++ b/src/test/java/org/elasticsearch/cluster/structure/RoutingIteratorTests.java @@ -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();