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:
parent
d111e169a4
commit
fef647cb92
|
@ -329,7 +329,7 @@ public class MetaDataCreateIndexService extends AbstractComponent {
|
||||||
ClusterState updatedState = newClusterStateBuilder().state(currentState).blocks(blocks).metaData(newMetaData).build();
|
ClusterState updatedState = newClusterStateBuilder().state(currentState).blocks(blocks).metaData(newMetaData).build();
|
||||||
|
|
||||||
if (request.state == State.OPEN) {
|
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));
|
.addAsNew(updatedState.metaData().index(request.index));
|
||||||
RoutingAllocation.Result routingResult = allocationService.reroute(newClusterStateBuilder().state(updatedState).routingTable(routingTableBuilder).build());
|
RoutingAllocation.Result routingResult = allocationService.reroute(newClusterStateBuilder().state(updatedState).routingTable(routingTableBuilder).build());
|
||||||
updatedState = newClusterStateBuilder().state(updatedState).routingResult(routingResult).build();
|
updatedState = newClusterStateBuilder().state(updatedState).routingResult(routingResult).build();
|
||||||
|
|
|
@ -122,7 +122,7 @@ public class MetaDataDeleteIndexService extends AbstractComponent {
|
||||||
|
|
||||||
logger.info("[{}] deleting index", request.index);
|
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);
|
routingTableBuilder.remove(request.index);
|
||||||
|
|
||||||
MetaData newMetaData = MetaData.builder(currentState.metaData())
|
MetaData newMetaData = MetaData.builder(currentState.metaData())
|
||||||
|
|
|
@ -123,8 +123,7 @@ public class MetaDataIndexStateService extends AbstractComponent {
|
||||||
|
|
||||||
ClusterState updatedState = ClusterState.builder().state(currentState).metaData(mdBuilder).blocks(blocksBuilder).build();
|
ClusterState updatedState = ClusterState.builder().state(currentState).metaData(mdBuilder).blocks(blocksBuilder).build();
|
||||||
|
|
||||||
RoutingTable.Builder rtBuilder = RoutingTable.builder()
|
RoutingTable.Builder rtBuilder = RoutingTable.builder(currentState.routingTable());
|
||||||
.routingTable(currentState.routingTable());
|
|
||||||
for (String index : indicesToClose) {
|
for (String index : indicesToClose) {
|
||||||
rtBuilder.remove(index);
|
rtBuilder.remove(index);
|
||||||
}
|
}
|
||||||
|
@ -194,8 +193,7 @@ public class MetaDataIndexStateService extends AbstractComponent {
|
||||||
|
|
||||||
ClusterState updatedState = ClusterState.builder().state(currentState).metaData(mdBuilder).blocks(blocksBuilder).build();
|
ClusterState updatedState = ClusterState.builder().state(currentState).metaData(mdBuilder).blocks(blocksBuilder).build();
|
||||||
|
|
||||||
RoutingTable.Builder rtBuilder = RoutingTable.builder()
|
RoutingTable.Builder rtBuilder = RoutingTable.builder(updatedState.routingTable());
|
||||||
.routingTable(updatedState.routingTable());
|
|
||||||
for (String index : indicesToOpen) {
|
for (String index : indicesToOpen) {
|
||||||
rtBuilder.addAsRecovery(updatedState.metaData().index(index));
|
rtBuilder.addAsRecovery(updatedState.metaData().index(index));
|
||||||
}
|
}
|
||||||
|
|
|
@ -231,7 +231,7 @@ public class MetaDataUpdateSettingsService extends AbstractComponent implements
|
||||||
@Override
|
@Override
|
||||||
public ClusterState execute(ClusterState currentState) {
|
public ClusterState execute(ClusterState currentState) {
|
||||||
String[] actualIndices = currentState.metaData().concreteIndices(request.indices());
|
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());
|
MetaData.Builder metaDataBuilder = MetaData.builder(currentState.metaData());
|
||||||
|
|
||||||
// allow to change any settings to a close index, and only allow dynamic settings to be changed
|
// allow to change any settings to a close index, and only allow dynamic settings to be changed
|
||||||
|
|
|
@ -300,10 +300,13 @@ public class IndexRoutingTable implements Iterable<IndexShardRoutingTable> {
|
||||||
public void validate() throws RoutingValidationException {
|
public void validate() throws RoutingValidationException {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Builder builder(String index) {
|
||||||
|
return new Builder(index);
|
||||||
|
}
|
||||||
|
|
||||||
public static class Builder {
|
public static class Builder {
|
||||||
|
|
||||||
private final String index;
|
private final String index;
|
||||||
|
|
||||||
private final Map<Integer, IndexShardRoutingTable> shards = new HashMap<Integer, IndexShardRoutingTable>();
|
private final Map<Integer, IndexShardRoutingTable> shards = new HashMap<Integer, IndexShardRoutingTable>();
|
||||||
|
|
||||||
public Builder(String index) {
|
public Builder(String index) {
|
||||||
|
|
|
@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -262,18 +262,24 @@ public class RoutingTable implements Iterable<IndexRoutingTable> {
|
||||||
return new Builder();
|
return new Builder();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Builder builder(RoutingTable routingTable) {
|
||||||
|
return new Builder(routingTable);
|
||||||
|
}
|
||||||
|
|
||||||
public static class Builder {
|
public static class Builder {
|
||||||
|
|
||||||
private long version;
|
private long version;
|
||||||
|
|
||||||
private final Map<String, IndexRoutingTable> indicesRouting = newHashMap();
|
private final Map<String, IndexRoutingTable> indicesRouting = newHashMap();
|
||||||
|
|
||||||
public Builder routingTable(RoutingTable routingTable) {
|
public Builder() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder(RoutingTable routingTable) {
|
||||||
version = routingTable.version;
|
version = routingTable.version;
|
||||||
for (IndexRoutingTable indexRoutingTable : routingTable) {
|
for (IndexRoutingTable indexRoutingTable : routingTable) {
|
||||||
indicesRouting.put(indexRoutingTable.index(), indexRoutingTable);
|
indicesRouting.put(indexRoutingTable.index(), indexRoutingTable);
|
||||||
}
|
}
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder updateNodes(RoutingNodes routingNodes) {
|
public Builder updateNodes(RoutingNodes routingNodes) {
|
||||||
|
|
|
@ -327,7 +327,7 @@ public class InternalClusterService extends AbstractLifecycleComponent<ClusterSe
|
||||||
// only the master controls the version numbers
|
// only the master controls the version numbers
|
||||||
Builder builder = ClusterState.builder().state(newClusterState).version(newClusterState.version() + 1);
|
Builder builder = ClusterState.builder().state(newClusterState).version(newClusterState.version() + 1);
|
||||||
if (previousClusterState.routingTable() != newClusterState.routingTable()) {
|
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()) {
|
if (previousClusterState.metaData() != newClusterState.metaData()) {
|
||||||
builder.metaData(MetaData.builder(newClusterState.metaData()).version(newClusterState.metaData().version() + 1));
|
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
|
// 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
|
// 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 builder = ClusterState.builder().state(newClusterState);
|
||||||
builder.routingTable(RoutingTable.builder().routingTable(newClusterState.routingTable()));
|
builder.routingTable(RoutingTable.builder(newClusterState.routingTable()));
|
||||||
builder.metaData(MetaData.builder(newClusterState.metaData()));
|
builder.metaData(MetaData.builder(newClusterState.metaData()));
|
||||||
newClusterState = builder.build();
|
newClusterState = builder.build();
|
||||||
logger.debug("got first state from fresh master [{}]", newClusterState.nodes().masterNodeId());
|
logger.debug("got first state from fresh master [{}]", newClusterState.nodes().masterNodeId());
|
||||||
|
|
|
@ -265,7 +265,7 @@ public class GatewayService extends AbstractLifecycleComponent<GatewayService> i
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
// initialize all index routing tables as empty
|
// initialize all index routing tables as empty
|
||||||
RoutingTable.Builder routingTableBuilder = RoutingTable.builder().routingTable(updatedState.routingTable());
|
RoutingTable.Builder routingTableBuilder = RoutingTable.builder(updatedState.routingTable());
|
||||||
for (IndexMetaData indexMetaData : updatedState.metaData().indices().values()) {
|
for (IndexMetaData indexMetaData : updatedState.metaData().indices().values()) {
|
||||||
routingTableBuilder.addAsRecovery(indexMetaData);
|
routingTableBuilder.addAsRecovery(indexMetaData);
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,7 +122,7 @@ public class LocalAllocateDangledIndices extends AbstractComponent {
|
||||||
}
|
}
|
||||||
MetaData.Builder metaData = MetaData.builder(currentState.metaData());
|
MetaData.Builder metaData = MetaData.builder(currentState.metaData());
|
||||||
ClusterBlocks.Builder blocks = ClusterBlocks.builder().blocks(currentState.blocks());
|
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;
|
boolean importNeeded = false;
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
|
@ -20,7 +20,6 @@ import org.junit.Test;
|
||||||
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
||||||
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
||||||
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
|
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.INITIALIZING;
|
||||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
|
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
|
||||||
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
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,
|
private ClusterState initCluster(AllocationService service, int numberOfNodes, int numberOfIndices, int numberOfShards,
|
||||||
int numberOfReplicas) {
|
int numberOfReplicas) {
|
||||||
MetaData.Builder metaDataBuilder = MetaData.builder();
|
MetaData.Builder metaDataBuilder = MetaData.builder();
|
||||||
RoutingTable.Builder routingTableBuilder = routingTable();
|
RoutingTable.Builder routingTableBuilder = RoutingTable.builder();
|
||||||
|
|
||||||
for (int i = 0; i < numberOfIndices; i++) {
|
for (int i = 0; i < numberOfIndices; i++) {
|
||||||
IndexMetaData.Builder index = newIndexMetaDataBuilder("test" + i).numberOfShards(numberOfShards).numberOfReplicas(
|
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,
|
private ClusterState addIndex(ClusterState clusterState, AllocationService service, int indexOrdinal, int numberOfShards,
|
||||||
int numberOfReplicas) {
|
int numberOfReplicas) {
|
||||||
MetaData.Builder metaDataBuilder = MetaData.builder(clusterState.getMetaData());
|
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(
|
IndexMetaData.Builder index = newIndexMetaDataBuilder("test" + indexOrdinal).numberOfShards(numberOfShards).numberOfReplicas(
|
||||||
numberOfReplicas);
|
numberOfReplicas);
|
||||||
|
|
|
@ -30,7 +30,6 @@ import org.junit.Test;
|
||||||
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
||||||
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
||||||
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
|
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.INITIALIZING;
|
||||||
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
||||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||||
|
@ -50,7 +49,7 @@ public class AllocatePostApiFlagTests extends ElasticsearchTestCase {
|
||||||
MetaData metaData = MetaData.builder()
|
MetaData metaData = MetaData.builder()
|
||||||
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(0))
|
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(0))
|
||||||
.build();
|
.build();
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test"))
|
.addAsNew(metaData.index("test"))
|
||||||
.build();
|
.build();
|
||||||
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();
|
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();
|
||||||
|
|
|
@ -43,7 +43,6 @@ import org.junit.Test;
|
||||||
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
||||||
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
||||||
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
|
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.INITIALIZING;
|
||||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
|
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
|
||||||
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
||||||
|
@ -64,7 +63,7 @@ public class AllocationCommandsTests extends ElasticsearchTestCase {
|
||||||
MetaData metaData = MetaData.builder()
|
MetaData metaData = MetaData.builder()
|
||||||
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(0))
|
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(0))
|
||||||
.build();
|
.build();
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test"))
|
.addAsNew(metaData.index("test"))
|
||||||
.build();
|
.build();
|
||||||
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();
|
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();
|
||||||
|
@ -111,7 +110,7 @@ public class AllocationCommandsTests extends ElasticsearchTestCase {
|
||||||
MetaData metaData = MetaData.builder()
|
MetaData metaData = MetaData.builder()
|
||||||
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
|
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
|
||||||
.build();
|
.build();
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test"))
|
.addAsNew(metaData.index("test"))
|
||||||
.build();
|
.build();
|
||||||
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();
|
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();
|
||||||
|
@ -192,7 +191,7 @@ public class AllocationCommandsTests extends ElasticsearchTestCase {
|
||||||
MetaData metaData = MetaData.builder()
|
MetaData metaData = MetaData.builder()
|
||||||
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
|
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
|
||||||
.build();
|
.build();
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test"))
|
.addAsNew(metaData.index("test"))
|
||||||
.build();
|
.build();
|
||||||
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();
|
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();
|
||||||
|
|
|
@ -33,7 +33,6 @@ import org.junit.Test;
|
||||||
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
||||||
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
||||||
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
|
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.ShardRoutingState.*;
|
||||||
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
||||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||||
|
@ -59,7 +58,7 @@ public class AwarenessAllocationTests extends ElasticsearchTestCase {
|
||||||
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
|
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test"))
|
.addAsNew(metaData.index("test"))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -128,7 +127,7 @@ public class AwarenessAllocationTests extends ElasticsearchTestCase {
|
||||||
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
|
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test"))
|
.addAsNew(metaData.index("test"))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -203,7 +202,7 @@ public class AwarenessAllocationTests extends ElasticsearchTestCase {
|
||||||
.put(newIndexMetaDataBuilder("test").numberOfShards(5).numberOfReplicas(1))
|
.put(newIndexMetaDataBuilder("test").numberOfShards(5).numberOfReplicas(1))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test"))
|
.addAsNew(metaData.index("test"))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -302,7 +301,7 @@ public class AwarenessAllocationTests extends ElasticsearchTestCase {
|
||||||
.put(newIndexMetaDataBuilder("test2").numberOfShards(5).numberOfReplicas(1))
|
.put(newIndexMetaDataBuilder("test2").numberOfShards(5).numberOfReplicas(1))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test1"))
|
.addAsNew(metaData.index("test1"))
|
||||||
.addAsNew(metaData.index("test2"))
|
.addAsNew(metaData.index("test2"))
|
||||||
.build();
|
.build();
|
||||||
|
@ -395,7 +394,7 @@ public class AwarenessAllocationTests extends ElasticsearchTestCase {
|
||||||
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(2))
|
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(2))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test"))
|
.addAsNew(metaData.index("test"))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -474,7 +473,7 @@ public class AwarenessAllocationTests extends ElasticsearchTestCase {
|
||||||
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(3))
|
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(3))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test"))
|
.addAsNew(metaData.index("test"))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -556,7 +555,7 @@ public class AwarenessAllocationTests extends ElasticsearchTestCase {
|
||||||
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
|
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test"))
|
.addAsNew(metaData.index("test"))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -624,7 +623,7 @@ public class AwarenessAllocationTests extends ElasticsearchTestCase {
|
||||||
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
|
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test"))
|
.addAsNew(metaData.index("test"))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -699,7 +698,7 @@ public class AwarenessAllocationTests extends ElasticsearchTestCase {
|
||||||
.put(newIndexMetaDataBuilder("test2").numberOfShards(5).numberOfReplicas(1))
|
.put(newIndexMetaDataBuilder("test2").numberOfShards(5).numberOfReplicas(1))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test1"))
|
.addAsNew(metaData.index("test1"))
|
||||||
.addAsNew(metaData.index("test2"))
|
.addAsNew(metaData.index("test2"))
|
||||||
.build();
|
.build();
|
||||||
|
@ -780,7 +779,7 @@ public class AwarenessAllocationTests extends ElasticsearchTestCase {
|
||||||
.put(newIndexMetaDataBuilder("test").numberOfShards(5).numberOfReplicas(1))
|
.put(newIndexMetaDataBuilder("test").numberOfShards(5).numberOfReplicas(1))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test"))
|
.addAsNew(metaData.index("test"))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,6 @@ import java.util.List;
|
||||||
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
||||||
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
||||||
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
|
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.INITIALIZING;
|
||||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
|
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
|
||||||
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
||||||
|
@ -145,7 +144,7 @@ public class BalanceConfigurationTests extends ElasticsearchTestCase {
|
||||||
|
|
||||||
private ClusterState initCluster(AllocationService strategy) {
|
private ClusterState initCluster(AllocationService strategy) {
|
||||||
MetaData.Builder metaDataBuilder = MetaData.builder();
|
MetaData.Builder metaDataBuilder = MetaData.builder();
|
||||||
RoutingTable.Builder routingTableBuilder = routingTable();
|
RoutingTable.Builder routingTableBuilder = RoutingTable.builder();
|
||||||
|
|
||||||
for (int i = 0; i < numberOfIndices; i++) {
|
for (int i = 0; i < numberOfIndices; i++) {
|
||||||
IndexMetaData.Builder index = newIndexMetaDataBuilder("test" + i).numberOfShards(numberOfShards).numberOfReplicas(numberOfReplicas);
|
IndexMetaData.Builder index = newIndexMetaDataBuilder("test" + i).numberOfShards(numberOfShards).numberOfReplicas(numberOfReplicas);
|
||||||
|
@ -453,7 +452,7 @@ public class BalanceConfigurationTests extends ElasticsearchTestCase {
|
||||||
}
|
}
|
||||||
}), ClusterInfoService.EMPTY);
|
}), ClusterInfoService.EMPTY);
|
||||||
MetaData.Builder metaDataBuilder = MetaData.builder();
|
MetaData.Builder metaDataBuilder = MetaData.builder();
|
||||||
RoutingTable.Builder routingTableBuilder = routingTable();
|
RoutingTable.Builder routingTableBuilder = RoutingTable.builder();
|
||||||
IndexMetaData.Builder indexMeta = newIndexMetaDataBuilder("test").numberOfShards(5).numberOfReplicas(1);
|
IndexMetaData.Builder indexMeta = newIndexMetaDataBuilder("test").numberOfShards(5).numberOfReplicas(1);
|
||||||
metaDataBuilder = metaDataBuilder.put(indexMeta);
|
metaDataBuilder = metaDataBuilder.put(indexMeta);
|
||||||
MetaData metaData = metaDataBuilder.build();
|
MetaData metaData = metaDataBuilder.build();
|
||||||
|
|
|
@ -32,7 +32,6 @@ import org.junit.Test;
|
||||||
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
||||||
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
||||||
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
|
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.ShardRoutingState.*;
|
||||||
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
||||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||||
|
@ -51,7 +50,7 @@ public class ClusterRebalanceRoutingTests extends ElasticsearchTestCase {
|
||||||
.put(newIndexMetaDataBuilder("test2").numberOfShards(1).numberOfReplicas(1))
|
.put(newIndexMetaDataBuilder("test2").numberOfShards(1).numberOfReplicas(1))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test1"))
|
.addAsNew(metaData.index("test1"))
|
||||||
.addAsNew(metaData.index("test2"))
|
.addAsNew(metaData.index("test2"))
|
||||||
.build();
|
.build();
|
||||||
|
@ -137,7 +136,7 @@ public class ClusterRebalanceRoutingTests extends ElasticsearchTestCase {
|
||||||
.put(newIndexMetaDataBuilder("test2").numberOfShards(1).numberOfReplicas(1))
|
.put(newIndexMetaDataBuilder("test2").numberOfShards(1).numberOfReplicas(1))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test1"))
|
.addAsNew(metaData.index("test1"))
|
||||||
.addAsNew(metaData.index("test2"))
|
.addAsNew(metaData.index("test2"))
|
||||||
.build();
|
.build();
|
||||||
|
@ -241,7 +240,7 @@ public class ClusterRebalanceRoutingTests extends ElasticsearchTestCase {
|
||||||
.put(newIndexMetaDataBuilder("test2").numberOfShards(1).numberOfReplicas(1))
|
.put(newIndexMetaDataBuilder("test2").numberOfShards(1).numberOfReplicas(1))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test1"))
|
.addAsNew(metaData.index("test1"))
|
||||||
.addAsNew(metaData.index("test2"))
|
.addAsNew(metaData.index("test2"))
|
||||||
.build();
|
.build();
|
||||||
|
@ -325,7 +324,7 @@ public class ClusterRebalanceRoutingTests extends ElasticsearchTestCase {
|
||||||
.put(newIndexMetaDataBuilder("test2").numberOfShards(1).numberOfReplicas(1))
|
.put(newIndexMetaDataBuilder("test2").numberOfShards(1).numberOfReplicas(1))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test1"))
|
.addAsNew(metaData.index("test1"))
|
||||||
.addAsNew(metaData.index("test2"))
|
.addAsNew(metaData.index("test2"))
|
||||||
.build();
|
.build();
|
||||||
|
@ -448,7 +447,7 @@ public class ClusterRebalanceRoutingTests extends ElasticsearchTestCase {
|
||||||
.put(newIndexMetaDataBuilder("test2").numberOfShards(1).numberOfReplicas(1))
|
.put(newIndexMetaDataBuilder("test2").numberOfShards(1).numberOfReplicas(1))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test1"))
|
.addAsNew(metaData.index("test1"))
|
||||||
.addAsNew(metaData.index("test2"))
|
.addAsNew(metaData.index("test2"))
|
||||||
.build();
|
.build();
|
||||||
|
@ -532,7 +531,7 @@ public class ClusterRebalanceRoutingTests extends ElasticsearchTestCase {
|
||||||
.put(newIndexMetaDataBuilder("test2").numberOfShards(1).numberOfReplicas(1))
|
.put(newIndexMetaDataBuilder("test2").numberOfShards(1).numberOfReplicas(1))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test1"))
|
.addAsNew(metaData.index("test1"))
|
||||||
.addAsNew(metaData.index("test2"))
|
.addAsNew(metaData.index("test2"))
|
||||||
.build();
|
.build();
|
||||||
|
|
|
@ -31,7 +31,6 @@ import org.junit.Test;
|
||||||
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
||||||
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
||||||
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
|
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.ShardRoutingState.*;
|
||||||
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
||||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||||
|
@ -55,7 +54,7 @@ public class ConcurrentRebalanceRoutingTests extends ElasticsearchTestCase {
|
||||||
.put(newIndexMetaDataBuilder("test").numberOfShards(5).numberOfReplicas(1))
|
.put(newIndexMetaDataBuilder("test").numberOfShards(5).numberOfReplicas(1))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test"))
|
.addAsNew(metaData.index("test"))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,6 @@ import org.junit.Test;
|
||||||
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
||||||
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
||||||
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
|
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.ShardRoutingState.*;
|
||||||
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
||||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||||
|
@ -55,7 +54,7 @@ public class DeadNodesAllocationTests extends ElasticsearchTestCase {
|
||||||
MetaData metaData = MetaData.builder()
|
MetaData metaData = MetaData.builder()
|
||||||
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
|
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
|
||||||
.build();
|
.build();
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test"))
|
.addAsNew(metaData.index("test"))
|
||||||
.build();
|
.build();
|
||||||
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();
|
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();
|
||||||
|
@ -107,7 +106,7 @@ public class DeadNodesAllocationTests extends ElasticsearchTestCase {
|
||||||
MetaData metaData = MetaData.builder()
|
MetaData metaData = MetaData.builder()
|
||||||
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
|
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
|
||||||
.build();
|
.build();
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test"))
|
.addAsNew(metaData.index("test"))
|
||||||
.build();
|
.build();
|
||||||
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();
|
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();
|
||||||
|
@ -182,7 +181,7 @@ public class DeadNodesAllocationTests extends ElasticsearchTestCase {
|
||||||
MetaData metaData = MetaData.builder()
|
MetaData metaData = MetaData.builder()
|
||||||
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
|
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
|
||||||
.build();
|
.build();
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test"))
|
.addAsNew(metaData.index("test"))
|
||||||
.build();
|
.build();
|
||||||
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();
|
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();
|
||||||
|
|
|
@ -32,7 +32,6 @@ import org.junit.Test;
|
||||||
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
||||||
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
||||||
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
|
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.INITIALIZING;
|
||||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
|
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
|
||||||
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
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))
|
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test"))
|
.addAsNew(metaData.index("test"))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -87,7 +86,7 @@ public class DisableAllocationTests extends ElasticsearchTestCase {
|
||||||
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
|
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test"))
|
.addAsNew(metaData.index("test"))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -119,7 +118,7 @@ public class DisableAllocationTests extends ElasticsearchTestCase {
|
||||||
.put(newIndexMetaDataBuilder("enabled").numberOfShards(1).numberOfReplicas(1))
|
.put(newIndexMetaDataBuilder("enabled").numberOfShards(1).numberOfReplicas(1))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("disabled"))
|
.addAsNew(metaData.index("disabled"))
|
||||||
.addAsNew(metaData.index("enabled"))
|
.addAsNew(metaData.index("enabled"))
|
||||||
.build();
|
.build();
|
||||||
|
|
|
@ -32,7 +32,6 @@ import org.junit.Test;
|
||||||
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
||||||
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
||||||
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
|
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.INITIALIZING;
|
||||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
|
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
|
||||||
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
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))
|
.put(newIndexMetaDataBuilder("test").numberOfShards(2).numberOfReplicas(1))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test"))
|
.addAsNew(metaData.index("test"))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,6 @@ import org.junit.Test;
|
||||||
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
||||||
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
||||||
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
|
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.INITIALIZING;
|
||||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
|
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
|
||||||
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
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))
|
.put(newIndexMetaDataBuilder("test2").numberOfShards(1).numberOfReplicas(1))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test1"))
|
.addAsNew(metaData.index("test1"))
|
||||||
.addAsNew(metaData.index("test2"))
|
.addAsNew(metaData.index("test2"))
|
||||||
.build();
|
.build();
|
||||||
|
@ -113,7 +112,7 @@ public class FailedNodeRoutingTests extends ElasticsearchTestCase {
|
||||||
.put(newIndexMetaDataBuilder("test2").numberOfShards(1).numberOfReplicas(1))
|
.put(newIndexMetaDataBuilder("test2").numberOfShards(1).numberOfReplicas(1))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test1"))
|
.addAsNew(metaData.index("test1"))
|
||||||
.addAsNew(metaData.index("test2"))
|
.addAsNew(metaData.index("test2"))
|
||||||
.build();
|
.build();
|
||||||
|
|
|
@ -35,7 +35,6 @@ import org.junit.Test;
|
||||||
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
||||||
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
||||||
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
|
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.ShardRoutingState.*;
|
||||||
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
||||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||||
|
@ -59,7 +58,7 @@ public class FailedShardsRoutingTests extends ElasticsearchTestCase {
|
||||||
MetaData metaData = MetaData.builder()
|
MetaData metaData = MetaData.builder()
|
||||||
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
|
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
|
||||||
.build();
|
.build();
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test"))
|
.addAsNew(metaData.index("test"))
|
||||||
.build();
|
.build();
|
||||||
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();
|
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();
|
||||||
|
@ -150,7 +149,7 @@ public class FailedShardsRoutingTests extends ElasticsearchTestCase {
|
||||||
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
|
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test"))
|
.addAsNew(metaData.index("test"))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -231,7 +230,7 @@ public class FailedShardsRoutingTests extends ElasticsearchTestCase {
|
||||||
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
|
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test"))
|
.addAsNew(metaData.index("test"))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -288,7 +287,7 @@ public class FailedShardsRoutingTests extends ElasticsearchTestCase {
|
||||||
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
|
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test"))
|
.addAsNew(metaData.index("test"))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -345,7 +344,7 @@ public class FailedShardsRoutingTests extends ElasticsearchTestCase {
|
||||||
.put(newIndexMetaDataBuilder("test").numberOfShards(2).numberOfReplicas(1))
|
.put(newIndexMetaDataBuilder("test").numberOfShards(2).numberOfReplicas(1))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test"))
|
.addAsNew(metaData.index("test"))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,6 @@ import java.util.List;
|
||||||
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
||||||
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
||||||
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
|
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.INITIALIZING;
|
||||||
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
||||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||||
|
@ -61,7 +60,7 @@ public class FilterRoutingTests extends ElasticsearchTestCase {
|
||||||
.put(newIndexMetaDataBuilder("test").numberOfShards(2).numberOfReplicas(1))
|
.put(newIndexMetaDataBuilder("test").numberOfShards(2).numberOfReplicas(1))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test"))
|
.addAsNew(metaData.index("test"))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -110,7 +109,7 @@ public class FilterRoutingTests extends ElasticsearchTestCase {
|
||||||
.build()))
|
.build()))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test"))
|
.addAsNew(metaData.index("test"))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,6 @@ import org.junit.Test;
|
||||||
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
||||||
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
||||||
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
|
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.ShardRoutingState.*;
|
||||||
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
||||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
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))
|
MetaData metaData = MetaData.builder().put(newIndexMetaDataBuilder("test").numberOfShards(3).numberOfReplicas(1))
|
||||||
.put(newIndexMetaDataBuilder("test1").numberOfShards(3).numberOfReplicas(1)).build();
|
.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();
|
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))
|
MetaData metaData = MetaData.builder().put(newIndexMetaDataBuilder("test").numberOfShards(3).numberOfReplicas(1))
|
||||||
.put(newIndexMetaDataBuilder("test1").numberOfShards(3).numberOfReplicas(1)).build();
|
.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();
|
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();
|
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();
|
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();
|
||||||
|
|
||||||
|
@ -455,7 +454,7 @@ public class IndexBalanceTests extends ElasticsearchTestCase {
|
||||||
.put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 1)
|
.put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 1)
|
||||||
))
|
))
|
||||||
.build();
|
.build();
|
||||||
routingTable = routingTable().routingTable(routingTable)
|
routingTable = RoutingTable.builder(routingTable)
|
||||||
.addAsNew(metaData.index("test1"))
|
.addAsNew(metaData.index("test1"))
|
||||||
.build();
|
.build();
|
||||||
clusterState = newClusterStateBuilder().state(clusterState).metaData(metaData).routingTable(routingTable).build();
|
clusterState = newClusterStateBuilder().state(clusterState).metaData(metaData).routingTable(routingTable).build();
|
||||||
|
|
|
@ -30,7 +30,6 @@ import org.junit.Test;
|
||||||
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
||||||
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
||||||
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
|
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.INITIALIZING;
|
||||||
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
||||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||||
|
@ -57,7 +56,7 @@ public class PreferPrimaryAllocationTests extends ElasticsearchTestCase {
|
||||||
.put(newIndexMetaDataBuilder("test2").numberOfShards(10).numberOfReplicas(0))
|
.put(newIndexMetaDataBuilder("test2").numberOfShards(10).numberOfReplicas(0))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test1"))
|
.addAsNew(metaData.index("test1"))
|
||||||
.addAsNew(metaData.index("test2"))
|
.addAsNew(metaData.index("test2"))
|
||||||
.build();
|
.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)");
|
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();
|
metaData = MetaData.builder(clusterState.metaData()).updateNumberOfReplicas(1).build();
|
||||||
clusterState = newClusterStateBuilder().state(clusterState).routingTable(routingTable).metaData(metaData).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))
|
.put(newIndexMetaDataBuilder("new_index").numberOfShards(4).numberOfReplicas(0))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
routingTable = routingTable().routingTable(clusterState.routingTable())
|
routingTable = RoutingTable.builder(clusterState.routingTable())
|
||||||
.addAsNew(metaData.index("new_index"))
|
.addAsNew(metaData.index("new_index"))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,6 @@ import org.junit.Test;
|
||||||
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
||||||
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
||||||
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
|
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.INITIALIZING;
|
||||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
|
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
|
||||||
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
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))
|
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test"))
|
.addAsNew(metaData.index("test"))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -107,7 +106,7 @@ public class PrimaryElectionRoutingTests extends ElasticsearchTestCase {
|
||||||
.put(newIndexMetaDataBuilder("test").numberOfShards(2).numberOfReplicas(1))
|
.put(newIndexMetaDataBuilder("test").numberOfShards(2).numberOfReplicas(1))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test"))
|
.addAsNew(metaData.index("test"))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,6 @@ import org.junit.Test;
|
||||||
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
||||||
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
||||||
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
|
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.INITIALIZING;
|
||||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
|
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
|
||||||
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
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))
|
.put(newIndexMetaDataBuilder("test").numberOfShards(5).numberOfReplicas(1))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test"))
|
.addAsNew(metaData.index("test"))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,6 @@ import java.util.Random;
|
||||||
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
||||||
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
||||||
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
|
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.INITIALIZING;
|
||||||
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
||||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||||
|
@ -77,7 +76,7 @@ public class RandomAllocationDeciderTests extends ElasticsearchTestCase {
|
||||||
|
|
||||||
}
|
}
|
||||||
MetaData metaData = metaBuilder.build();
|
MetaData metaData = metaBuilder.build();
|
||||||
RoutingTable.Builder routingTableBuilder = routingTable();
|
RoutingTable.Builder routingTableBuilder = RoutingTable.builder();
|
||||||
for (int i = 0; i < indices; i++) {
|
for (int i = 0; i < indices; i++) {
|
||||||
routingTableBuilder.addAsNew(metaData.index("INDEX_" + i));
|
routingTableBuilder.addAsNew(metaData.index("INDEX_" + i));
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,6 @@ import org.junit.Test;
|
||||||
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
||||||
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
||||||
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
|
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.ShardRoutingState.*;
|
||||||
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
||||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||||
|
@ -60,7 +59,7 @@ public class RebalanceAfterActiveTests extends ElasticsearchTestCase {
|
||||||
.put(newIndexMetaDataBuilder("test").numberOfShards(5).numberOfReplicas(1))
|
.put(newIndexMetaDataBuilder("test").numberOfShards(5).numberOfReplicas(1))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test"))
|
.addAsNew(metaData.index("test"))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,6 @@ import org.junit.Test;
|
||||||
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
||||||
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
||||||
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
|
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.ShardRoutingState.*;
|
||||||
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
||||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||||
|
@ -55,7 +54,7 @@ public class ReplicaAllocatedAfterPrimaryTests extends ElasticsearchTestCase {
|
||||||
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
|
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test"))
|
.addAsNew(metaData.index("test"))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,6 @@ import org.junit.Test;
|
||||||
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
||||||
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
||||||
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
|
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.INITIALIZING;
|
||||||
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
||||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||||
|
@ -35,7 +34,7 @@ public class SameShardRoutingTests extends ElasticsearchTestCase {
|
||||||
.put(newIndexMetaDataBuilder("test").numberOfShards(2).numberOfReplicas(1))
|
.put(newIndexMetaDataBuilder("test").numberOfShards(2).numberOfReplicas(1))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test"))
|
.addAsNew(metaData.index("test"))
|
||||||
.build();
|
.build();
|
||||||
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();
|
ClusterState clusterState = newClusterStateBuilder().metaData(metaData).routingTable(routingTable).build();
|
||||||
|
|
|
@ -32,7 +32,6 @@ import org.junit.Test;
|
||||||
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
||||||
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
||||||
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
|
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.ShardRoutingState.*;
|
||||||
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
||||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||||
|
@ -51,7 +50,7 @@ public class ShardVersioningTests extends ElasticsearchTestCase {
|
||||||
.put(newIndexMetaDataBuilder("test2").numberOfShards(1).numberOfReplicas(1))
|
.put(newIndexMetaDataBuilder("test2").numberOfShards(1).numberOfReplicas(1))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test1"))
|
.addAsNew(metaData.index("test1"))
|
||||||
.addAsNew(metaData.index("test2"))
|
.addAsNew(metaData.index("test2"))
|
||||||
.build();
|
.build();
|
||||||
|
|
|
@ -36,7 +36,6 @@ import org.junit.Test;
|
||||||
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
||||||
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
||||||
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
|
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.ShardRoutingState.*;
|
||||||
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
||||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
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)))
|
.put(ShardsLimitAllocationDecider.INDEX_TOTAL_SHARDS_PER_NODE, 2)))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test"))
|
.addAsNew(metaData.index("test"))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -111,7 +110,7 @@ public class ShardsLimitAllocationTests extends ElasticsearchTestCase {
|
||||||
))
|
))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test"))
|
.addAsNew(metaData.index("test"))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -135,7 +134,7 @@ public class ShardsLimitAllocationTests extends ElasticsearchTestCase {
|
||||||
.put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0)
|
.put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||||
))
|
))
|
||||||
.build();
|
.build();
|
||||||
routingTable = routingTable().routingTable(routingTable)
|
routingTable = RoutingTable.builder(routingTable)
|
||||||
.addAsNew(metaData.index("test1"))
|
.addAsNew(metaData.index("test1"))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,6 @@ import static com.google.common.collect.Sets.newHashSet;
|
||||||
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
||||||
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
||||||
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
|
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.ShardRoutingState.*;
|
||||||
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
||||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||||
|
@ -63,7 +62,7 @@ public class SingleShardNoReplicasRoutingTests extends ElasticsearchTestCase {
|
||||||
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(0))
|
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(0))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test"))
|
.addAsNew(metaData.index("test"))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -165,7 +164,7 @@ public class SingleShardNoReplicasRoutingTests extends ElasticsearchTestCase {
|
||||||
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(0))
|
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(0))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test"))
|
.addAsNew(metaData.index("test"))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -222,7 +221,7 @@ public class SingleShardNoReplicasRoutingTests extends ElasticsearchTestCase {
|
||||||
}
|
}
|
||||||
MetaData metaData = metaDataBuilder.build();
|
MetaData metaData = metaDataBuilder.build();
|
||||||
|
|
||||||
RoutingTable.Builder routingTableBuilder = routingTable();
|
RoutingTable.Builder routingTableBuilder = RoutingTable.builder();
|
||||||
for (int i = 0; i < numberOfIndices; i++) {
|
for (int i = 0; i < numberOfIndices; i++) {
|
||||||
routingTableBuilder.addAsNew(metaData.index("test" + i));
|
routingTableBuilder.addAsNew(metaData.index("test" + i));
|
||||||
}
|
}
|
||||||
|
@ -335,7 +334,7 @@ public class SingleShardNoReplicasRoutingTests extends ElasticsearchTestCase {
|
||||||
}
|
}
|
||||||
MetaData metaData = metaDataBuilder.build();
|
MetaData metaData = metaDataBuilder.build();
|
||||||
|
|
||||||
RoutingTable.Builder routingTableBuilder = routingTable();
|
RoutingTable.Builder routingTableBuilder = RoutingTable.builder();
|
||||||
for (int i = 0; i < numberOfIndices; i++) {
|
for (int i = 0; i < numberOfIndices; i++) {
|
||||||
routingTableBuilder.addAsNew(metaData.index("test" + i));
|
routingTableBuilder.addAsNew(metaData.index("test" + i));
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,6 @@ import org.junit.Test;
|
||||||
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
||||||
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
||||||
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
|
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.ShardRoutingState.*;
|
||||||
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
||||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||||
|
@ -55,7 +54,7 @@ public class SingleShardOneReplicaRoutingTests extends ElasticsearchTestCase {
|
||||||
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
|
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test"))
|
.addAsNew(metaData.index("test"))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,6 @@ import org.junit.Test;
|
||||||
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
||||||
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
||||||
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
|
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.ShardRoutingState.*;
|
||||||
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
||||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||||
|
@ -62,7 +61,7 @@ public class TenShardsOneReplicaRoutingTests extends ElasticsearchTestCase {
|
||||||
.put(newIndexMetaDataBuilder("test").numberOfShards(10).numberOfReplicas(1))
|
.put(newIndexMetaDataBuilder("test").numberOfShards(10).numberOfReplicas(1))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test"))
|
.addAsNew(metaData.index("test"))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,6 @@ import org.junit.Test;
|
||||||
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
||||||
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
||||||
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
|
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.ShardRoutingState.*;
|
||||||
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
||||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||||
|
@ -56,7 +55,7 @@ public class ThrottlingAllocationTests extends ElasticsearchTestCase {
|
||||||
.put(newIndexMetaDataBuilder("test").numberOfShards(10).numberOfReplicas(1))
|
.put(newIndexMetaDataBuilder("test").numberOfShards(10).numberOfReplicas(1))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test"))
|
.addAsNew(metaData.index("test"))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -117,7 +116,7 @@ public class ThrottlingAllocationTests extends ElasticsearchTestCase {
|
||||||
.put(newIndexMetaDataBuilder("test").numberOfShards(5).numberOfReplicas(1))
|
.put(newIndexMetaDataBuilder("test").numberOfShards(5).numberOfReplicas(1))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test"))
|
.addAsNew(metaData.index("test"))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,6 @@ import org.junit.Test;
|
||||||
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
||||||
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
||||||
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
|
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.ShardRoutingState.*;
|
||||||
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
||||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||||
|
@ -35,7 +34,7 @@ public class UpdateNumberOfReplicasTests extends ElasticsearchTestCase {
|
||||||
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
|
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test"))
|
.addAsNew(metaData.index("test"))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -82,7 +81,7 @@ public class UpdateNumberOfReplicasTests extends ElasticsearchTestCase {
|
||||||
logger.info("add another replica");
|
logger.info("add another replica");
|
||||||
routingNodes = clusterState.routingNodes();
|
routingNodes = clusterState.routingNodes();
|
||||||
prevRoutingTable = routingTable;
|
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();
|
metaData = MetaData.builder(clusterState.metaData()).updateNumberOfReplicas(2).build();
|
||||||
clusterState = newClusterStateBuilder().state(clusterState).routingTable(routingTable).metaData(metaData).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");
|
logger.info("now remove a replica");
|
||||||
routingNodes = clusterState.routingNodes();
|
routingNodes = clusterState.routingNodes();
|
||||||
prevRoutingTable = routingTable;
|
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();
|
metaData = MetaData.builder(clusterState.metaData()).updateNumberOfReplicas(1).build();
|
||||||
clusterState = newClusterStateBuilder().state(clusterState).routingTable(routingTable).metaData(metaData).build();
|
clusterState = newClusterStateBuilder().state(clusterState).routingTable(routingTable).metaData(metaData).build();
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,6 @@ import java.util.Map;
|
||||||
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
||||||
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
||||||
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
|
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.ShardRoutingState.*;
|
||||||
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
||||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||||
|
@ -91,7 +90,7 @@ public class DiskThresholdDeciderTests extends ElasticsearchTestCase {
|
||||||
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
|
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test"))
|
.addAsNew(metaData.index("test"))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -280,7 +279,7 @@ public class DiskThresholdDeciderTests extends ElasticsearchTestCase {
|
||||||
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
|
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test"))
|
.addAsNew(metaData.index("test"))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -466,7 +465,7 @@ public class DiskThresholdDeciderTests extends ElasticsearchTestCase {
|
||||||
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(0))
|
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(0))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test"))
|
.addAsNew(metaData.index("test"))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -528,7 +527,7 @@ public class DiskThresholdDeciderTests extends ElasticsearchTestCase {
|
||||||
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(0))
|
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(0))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test"))
|
.addAsNew(metaData.index("test"))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,6 @@ import org.junit.Test;
|
||||||
|
|
||||||
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
||||||
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
||||||
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
|
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -48,7 +47,7 @@ public class ClusterSerializationTests extends ElasticsearchTestCase {
|
||||||
.put(newIndexMetaDataBuilder("test").numberOfShards(10).numberOfReplicas(1))
|
.put(newIndexMetaDataBuilder("test").numberOfShards(10).numberOfReplicas(1))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test"))
|
.addAsNew(metaData.index("test"))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -71,7 +70,7 @@ public class ClusterSerializationTests extends ElasticsearchTestCase {
|
||||||
.put(newIndexMetaDataBuilder("test").numberOfShards(10).numberOfReplicas(1))
|
.put(newIndexMetaDataBuilder("test").numberOfShards(10).numberOfReplicas(1))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test"))
|
.addAsNew(metaData.index("test"))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,6 @@ import org.junit.Test;
|
||||||
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
||||||
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
||||||
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
|
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.INITIALIZING;
|
||||||
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
||||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||||
|
@ -88,7 +87,7 @@ public class RoutingIteratorTests extends ElasticsearchTestCase {
|
||||||
MetaData metaData = MetaData.builder()
|
MetaData metaData = MetaData.builder()
|
||||||
.put(newIndexMetaDataBuilder("test1").numberOfShards(1).numberOfReplicas(2))
|
.put(newIndexMetaDataBuilder("test1").numberOfShards(1).numberOfReplicas(2))
|
||||||
.build();
|
.build();
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test1"))
|
.addAsNew(metaData.index("test1"))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -124,7 +123,7 @@ public class RoutingIteratorTests extends ElasticsearchTestCase {
|
||||||
.put(newIndexMetaDataBuilder("test2").numberOfShards(1).numberOfReplicas(1))
|
.put(newIndexMetaDataBuilder("test2").numberOfShards(1).numberOfReplicas(1))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test1"))
|
.addAsNew(metaData.index("test1"))
|
||||||
.addAsNew(metaData.index("test2"))
|
.addAsNew(metaData.index("test2"))
|
||||||
.build();
|
.build();
|
||||||
|
@ -227,7 +226,7 @@ public class RoutingIteratorTests extends ElasticsearchTestCase {
|
||||||
.put(newIndexMetaDataBuilder("test2").numberOfShards(1).numberOfReplicas(1))
|
.put(newIndexMetaDataBuilder("test2").numberOfShards(1).numberOfReplicas(1))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test1"))
|
.addAsNew(metaData.index("test1"))
|
||||||
.addAsNew(metaData.index("test2"))
|
.addAsNew(metaData.index("test2"))
|
||||||
.build();
|
.build();
|
||||||
|
@ -260,7 +259,7 @@ public class RoutingIteratorTests extends ElasticsearchTestCase {
|
||||||
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
|
.put(newIndexMetaDataBuilder("test").numberOfShards(1).numberOfReplicas(1))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test"))
|
.addAsNew(metaData.index("test"))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -309,7 +308,7 @@ public class RoutingIteratorTests extends ElasticsearchTestCase {
|
||||||
.put(newIndexMetaDataBuilder("test").numberOfShards(5).numberOfReplicas(1))
|
.put(newIndexMetaDataBuilder("test").numberOfShards(5).numberOfReplicas(1))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
RoutingTable routingTable = routingTable()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.addAsNew(metaData.index("test"))
|
.addAsNew(metaData.index("test"))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue