diff --git a/src/main/java/org/elasticsearch/action/admin/cluster/state/TransportClusterStateAction.java b/src/main/java/org/elasticsearch/action/admin/cluster/state/TransportClusterStateAction.java index b488828e149..30e3096dc8c 100644 --- a/src/main/java/org/elasticsearch/action/admin/cluster/state/TransportClusterStateAction.java +++ b/src/main/java/org/elasticsearch/action/admin/cluster/state/TransportClusterStateAction.java @@ -73,7 +73,7 @@ public class TransportClusterStateAction extends TransportMasterNodeReadOperatio protected void masterOperation(final ClusterStateRequest request, final ClusterState state, ActionListener listener) throws ElasticsearchException { ClusterState currentState = clusterService.state(); logger.trace("Serving cluster state request using version {}", currentState.version()); - ClusterState.Builder builder = ClusterState.builder(); + ClusterState.Builder builder = ClusterState.builder(currentState.getClusterName()); builder.version(currentState.version()); if (request.nodes()) { builder.nodes(currentState.nodes()); diff --git a/src/main/java/org/elasticsearch/cluster/ClusterState.java b/src/main/java/org/elasticsearch/cluster/ClusterState.java index 590456f56a6..802503098e8 100644 --- a/src/main/java/org/elasticsearch/cluster/ClusterState.java +++ b/src/main/java/org/elasticsearch/cluster/ClusterState.java @@ -110,17 +110,20 @@ public class ClusterState implements ToXContent { private final ImmutableOpenMap customs; + private final ClusterName clusterName; + // built on demand private volatile RoutingNodes routingNodes; private SettingsFilter settingsFilter; public ClusterState(long version, ClusterState state) { - this(version, state.metaData(), state.routingTable(), state.nodes(), state.blocks(), state.customs()); + this(state.clusterName, version, state.metaData(), state.routingTable(), state.nodes(), state.blocks(), state.customs()); } - public ClusterState(long version, MetaData metaData, RoutingTable routingTable, DiscoveryNodes nodes, ClusterBlocks blocks, ImmutableOpenMap customs) { + public ClusterState(ClusterName clusterName, long version, MetaData metaData, RoutingTable routingTable, DiscoveryNodes nodes, ClusterBlocks blocks, ImmutableOpenMap customs) { this.version = version; + this.clusterName = clusterName; this.metaData = metaData; this.routingTable = routingTable; this.nodes = nodes; @@ -184,6 +187,10 @@ public class ClusterState implements ToXContent { return this.customs; } + public ClusterName getClusterName() { + return this.clusterName; + } + /** * Returns a built (on demand) routing nodes view of the routing table. NOTE, the routing nodes * are mutable, use them just for read operations @@ -420,8 +427,8 @@ public class ClusterState implements ToXContent { return builder; } - public static Builder builder() { - return new Builder(); + public static Builder builder(ClusterName clusterName) { + return new Builder(clusterName); } public static Builder builder(ClusterState state) { @@ -430,6 +437,7 @@ public class ClusterState implements ToXContent { public static class Builder { + private final ClusterName clusterName; private long version = 0; private MetaData metaData = MetaData.EMPTY_META_DATA; private RoutingTable routingTable = RoutingTable.EMPTY_ROUTING_TABLE; @@ -437,11 +445,9 @@ public class ClusterState implements ToXContent { private ClusterBlocks blocks = ClusterBlocks.EMPTY_CLUSTER_BLOCK; private final ImmutableOpenMap.Builder customs; - public Builder() { - customs = ImmutableOpenMap.builder(); - } public Builder(ClusterState state) { + this.clusterName = state.clusterName; this.version = state.version(); this.nodes = state.nodes(); this.routingTable = state.routingTable(); @@ -450,6 +456,11 @@ public class ClusterState implements ToXContent { this.customs = ImmutableOpenMap.builder(state.customs()); } + public Builder(ClusterName clusterName) { + customs = ImmutableOpenMap.builder(); + this.clusterName = clusterName; + } + public Builder nodes(DiscoveryNodes.Builder nodesBuilder) { return nodes(nodesBuilder.build()); } @@ -511,7 +522,7 @@ public class ClusterState implements ToXContent { } public ClusterState build() { - return new ClusterState(version, metaData, routingTable, nodes, blocks, customs.build()); + return new ClusterState(clusterName, version, metaData, routingTable, nodes, blocks, customs.build()); } public static byte[] toBytes(ClusterState state) throws IOException { @@ -525,6 +536,12 @@ public class ClusterState implements ToXContent { } public static void writeTo(ClusterState state, StreamOutput out) throws IOException { + if (out.getVersion().onOrAfter(Version.V_1_1_1)) { + out.writeBoolean(state.clusterName != null); + if (state.clusterName != null) { + state.clusterName.writeTo(out); + } + } out.writeLong(state.version()); MetaData.Builder.writeTo(state.metaData(), out); RoutingTable.Builder.writeTo(state.routingTable(), out); @@ -542,7 +559,14 @@ public class ClusterState implements ToXContent { } public static ClusterState readFrom(StreamInput in, @Nullable DiscoveryNode localNode) throws IOException { - Builder builder = new Builder(); + ClusterName clusterName = null; + if (in.getVersion().onOrAfter(Version.V_1_1_1)) { + // it might be null even if it comes from a >= 1.1.1 node since it's origin might be an older node + if (in.readBoolean()) { + clusterName = ClusterName.readClusterName(in); + } + } + Builder builder = new Builder(clusterName); builder.version = in.readLong(); builder.metaData = MetaData.Builder.readFrom(in); builder.routingTable = RoutingTable.Builder.readFrom(in); diff --git a/src/main/java/org/elasticsearch/cluster/service/InternalClusterService.java b/src/main/java/org/elasticsearch/cluster/service/InternalClusterService.java index 5f5e90f0f4c..ed204dcb4bc 100644 --- a/src/main/java/org/elasticsearch/cluster/service/InternalClusterService.java +++ b/src/main/java/org/elasticsearch/cluster/service/InternalClusterService.java @@ -81,7 +81,7 @@ public class InternalClusterService extends AbstractLifecycleComponent onGoingTimeouts = ConcurrentCollections.newQueue(); - private volatile ClusterState clusterState = ClusterState.builder().build(); + private volatile ClusterState clusterState; private final ClusterBlocks.Builder initialBlocks = ClusterBlocks.builder().addGlobalBlock(Discovery.NO_MASTER_BLOCK); @@ -89,13 +89,14 @@ public class InternalClusterService extends AbstractLifecycleComponent implements private final TransportNodesListGatewayMetaState listGatewayMetaState; private final String initialMeta; + private final ClusterName clusterName; @Inject public LocalGateway(Settings settings, ClusterService clusterService, NodeEnvironment nodeEnv, LocalGatewayShardsState shardsState, LocalGatewayMetaState metaState, - TransportNodesListGatewayMetaState listGatewayMetaState) { + TransportNodesListGatewayMetaState listGatewayMetaState, ClusterName clusterName) { super(settings); this.clusterService = clusterService; this.nodeEnv = nodeEnv; this.metaState = metaState; this.listGatewayMetaState = listGatewayMetaState; + this.clusterName = clusterName; this.shardsState = shardsState; @@ -186,7 +185,7 @@ public class LocalGateway extends AbstractLifecycleComponent implements } } } - ClusterState.Builder builder = ClusterState.builder(); + ClusterState.Builder builder = ClusterState.builder(clusterName); builder.metaData(metaDataBuilder); listener.onSuccess(builder.build()); } diff --git a/src/main/java/org/elasticsearch/gateway/none/NoneGateway.java b/src/main/java/org/elasticsearch/gateway/none/NoneGateway.java index df1c45e70f4..5a9abdeb5e2 100644 --- a/src/main/java/org/elasticsearch/gateway/none/NoneGateway.java +++ b/src/main/java/org/elasticsearch/gateway/none/NoneGateway.java @@ -20,10 +20,7 @@ package org.elasticsearch.gateway.none; import org.elasticsearch.ElasticsearchException; -import org.elasticsearch.cluster.ClusterChangedEvent; -import org.elasticsearch.cluster.ClusterService; -import org.elasticsearch.cluster.ClusterState; -import org.elasticsearch.cluster.ClusterStateListener; +import org.elasticsearch.cluster.*; import org.elasticsearch.cluster.action.index.NodeIndexDeletedAction; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.cluster.metadata.MetaData; @@ -49,16 +46,18 @@ public class NoneGateway extends AbstractLifecycleComponent implements private final ClusterService clusterService; private final NodeEnvironment nodeEnv; private final NodeIndexDeletedAction nodeIndexDeletedAction; + private final ClusterName clusterName; @Nullable private volatile MetaData currentMetaData; @Inject - public NoneGateway(Settings settings, ClusterService clusterService, NodeEnvironment nodeEnv, NodeIndexDeletedAction nodeIndexDeletedAction) { + public NoneGateway(Settings settings, ClusterService clusterService, NodeEnvironment nodeEnv, NodeIndexDeletedAction nodeIndexDeletedAction, ClusterName clusterName) { super(settings); this.clusterService = clusterService; this.nodeEnv = nodeEnv; this.nodeIndexDeletedAction = nodeIndexDeletedAction; + this.clusterName = clusterName; clusterService.addLast(this); } @@ -88,7 +87,7 @@ public class NoneGateway extends AbstractLifecycleComponent implements @Override public void performStateRecovery(GatewayStateRecoveredListener listener) throws GatewayException { logger.debug("performing state recovery"); - listener.onSuccess(ClusterState.builder().build()); + listener.onSuccess(ClusterState.builder(clusterName).build()); } @Override diff --git a/src/test/java/org/elasticsearch/benchmark/cluster/ClusterAllocationRerouteBenchmark.java b/src/test/java/org/elasticsearch/benchmark/cluster/ClusterAllocationRerouteBenchmark.java index 855744b0aba..67030822fbe 100644 --- a/src/test/java/org/elasticsearch/benchmark/cluster/ClusterAllocationRerouteBenchmark.java +++ b/src/test/java/org/elasticsearch/benchmark/cluster/ClusterAllocationRerouteBenchmark.java @@ -19,6 +19,7 @@ package org.elasticsearch.benchmark.cluster; import com.google.common.collect.ImmutableMap; +import org.elasticsearch.cluster.ClusterName; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.cluster.metadata.MetaData; @@ -65,7 +66,7 @@ public class ClusterAllocationRerouteBenchmark { for (int i = 1; i <= numberOfNodes; i++) { nb.put(ElasticsearchAllocationTestCase.newNode("node" + i, numberOfTags == 0 ? ImmutableMap.of() : ImmutableMap.of("tag", "tag_" + (i % numberOfTags)))); } - ClusterState initialClusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).nodes(nb).build(); + ClusterState initialClusterState = ClusterState.builder(ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).nodes(nb).build(); long start = System.currentTimeMillis(); for (int i = 0; i < numberOfRuns; i++) { diff --git a/src/test/java/org/elasticsearch/cluster/ClusterHealthResponsesTests.java b/src/test/java/org/elasticsearch/cluster/ClusterHealthResponsesTests.java index 4212ebab4ea..e3894e648f0 100644 --- a/src/test/java/org/elasticsearch/cluster/ClusterHealthResponsesTests.java +++ b/src/test/java/org/elasticsearch/cluster/ClusterHealthResponsesTests.java @@ -187,7 +187,7 @@ public class ClusterHealthResponsesTests extends ElasticsearchTestCase { metaData.put(indexMetaData, true); routingTable.add(indexRoutingTable); } - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); ClusterHealthResponse clusterHealth = new ClusterHealthResponse("bla", clusterState.metaData().concreteIndices(null), clusterState); logger.info("cluster status: {}, expected {}", clusterHealth.getStatus(), counter.status()); @@ -208,7 +208,7 @@ public class ClusterHealthResponsesTests extends ElasticsearchTestCase { MetaData.Builder metaData = MetaData.builder(); metaData.put(indexMetaData, true); routingTable.add(indexRoutingTable); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); ClusterHealthResponse clusterHealth = new ClusterHealthResponse("bla", clusterState.metaData().concreteIndices(null), clusterState); // currently we have no cluster level validation failures as index validation issues are reported per index. assertThat(clusterHealth.getValidationFailures(), Matchers.hasSize(0)); diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/AddIncrementallyTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/AddIncrementallyTests.java index 9563cd05813..3b01847b031 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/AddIncrementallyTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/AddIncrementallyTests.java @@ -310,7 +310,7 @@ public class AddIncrementallyTests extends ElasticsearchAllocationTestCase { for (int i = 0; i < numberOfNodes; i++) { nodes.put(newNode("node" + i)); } - ClusterState clusterState = ClusterState.builder().nodes(nodes).metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).nodes(nodes).metaData(metaData).routingTable(routingTable).build(); routingTable = service.reroute(clusterState).routingTable(); clusterState = ClusterState.builder(clusterState).routingTable(routingTable).build(); RoutingNodes routingNodes = clusterState.routingNodes(); diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/AllocatePostApiFlagTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/AllocatePostApiFlagTests.java index a7495351220..6cc0b16d1cb 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/AllocatePostApiFlagTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/AllocatePostApiFlagTests.java @@ -19,6 +19,7 @@ package org.elasticsearch.cluster.routing.allocation; +import org.elasticsearch.cluster.ClusterName; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.cluster.metadata.MetaData; @@ -50,7 +51,7 @@ public class AllocatePostApiFlagTests extends ElasticsearchAllocationTestCase { RoutingTable routingTable = RoutingTable.builder() .addAsNew(metaData.index("test")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); assertThat(clusterState.routingTable().index("test").shard(0).primaryAllocatedPostApi(), equalTo(false)); logger.info("adding two nodes and performing rerouting"); diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/AllocationCommandsTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/AllocationCommandsTests.java index 2e76b20a5b7..df996499ea7 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/AllocationCommandsTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/AllocationCommandsTests.java @@ -64,7 +64,7 @@ public class AllocationCommandsTests extends ElasticsearchAllocationTestCase { RoutingTable routingTable = RoutingTable.builder() .addAsNew(metaData.index("test")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); logger.info("adding two nodes and performing rerouting"); clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder().put(newNode("node1")).put(newNode("node2"))).build(); @@ -111,7 +111,7 @@ public class AllocationCommandsTests extends ElasticsearchAllocationTestCase { RoutingTable routingTable = RoutingTable.builder() .addAsNew(metaData.index("test")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); logger.info("--> adding 3 nodes on same rack and do rerouting"); clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder() @@ -200,7 +200,7 @@ public class AllocationCommandsTests extends ElasticsearchAllocationTestCase { RoutingTable routingTable = RoutingTable.builder() .addAsNew(metaData.index("test")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); logger.info("--> adding 3 nodes"); clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder() diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/AwarenessAllocationTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/AwarenessAllocationTests.java index 929fb54cd4f..2fd018c6c4c 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/AwarenessAllocationTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/AwarenessAllocationTests.java @@ -60,7 +60,7 @@ public class AwarenessAllocationTests extends ElasticsearchAllocationTestCase { .addAsNew(metaData.index("test")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); logger.info("--> adding two nodes on same rack and do rerouting"); clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder() @@ -129,7 +129,7 @@ public class AwarenessAllocationTests extends ElasticsearchAllocationTestCase { .addAsNew(metaData.index("test")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); logger.info("--> adding two nodes on same rack and do rerouting"); clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder() @@ -204,7 +204,7 @@ public class AwarenessAllocationTests extends ElasticsearchAllocationTestCase { .addAsNew(metaData.index("test")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); logger.info("--> adding two nodes on same rack and do rerouting"); clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder() @@ -304,7 +304,7 @@ public class AwarenessAllocationTests extends ElasticsearchAllocationTestCase { .addAsNew(metaData.index("test2")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); logger.info("--> adding two nodes on same rack and do rerouting"); clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder() @@ -396,7 +396,7 @@ public class AwarenessAllocationTests extends ElasticsearchAllocationTestCase { .addAsNew(metaData.index("test")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); logger.info("--> adding two nodes on same rack and do rerouting"); clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder() @@ -475,7 +475,7 @@ public class AwarenessAllocationTests extends ElasticsearchAllocationTestCase { .addAsNew(metaData.index("test")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); logger.info("--> adding two nodes on same rack and do rerouting"); clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder() @@ -557,7 +557,7 @@ public class AwarenessAllocationTests extends ElasticsearchAllocationTestCase { .addAsNew(metaData.index("test")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); logger.info("--> adding two nodes on same rack and do rerouting"); clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder() @@ -625,7 +625,7 @@ public class AwarenessAllocationTests extends ElasticsearchAllocationTestCase { .addAsNew(metaData.index("test")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); logger.info("--> adding two nodes on same rack and do rerouting"); clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder() @@ -701,7 +701,7 @@ public class AwarenessAllocationTests extends ElasticsearchAllocationTestCase { .addAsNew(metaData.index("test2")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); logger.info("--> adding two nodes on same rack and do rerouting"); clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder() @@ -781,7 +781,7 @@ public class AwarenessAllocationTests extends ElasticsearchAllocationTestCase { .addAsNew(metaData.index("test")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); logger.info("--> adding two nodes on same rack and do rerouting"); clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder() diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/BalanceConfigurationTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/BalanceConfigurationTests.java index a7c29affced..7536ea45b30 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/BalanceConfigurationTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/BalanceConfigurationTests.java @@ -159,7 +159,7 @@ public class BalanceConfigurationTests extends ElasticsearchAllocationTestCase { for (int i = 0; i < numberOfNodes; i++) { nodes.put(newNode("node" + i)); } - ClusterState clusterState = ClusterState.builder().nodes(nodes).metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).nodes(nodes).metaData(metaData).routingTable(routingTable).build(); routingTable = strategy.reroute(clusterState).routingTable(); clusterState = ClusterState.builder(clusterState).routingTable(routingTable).build(); RoutingNodes routingNodes = clusterState.routingNodes(); @@ -459,7 +459,7 @@ public class BalanceConfigurationTests extends ElasticsearchAllocationTestCase { nodes.put(node); } - ClusterState clusterState = ClusterState.builder().nodes(nodes).metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).nodes(nodes).metaData(metaData).routingTable(routingTable).build(); routingTable = strategy.reroute(clusterState).routingTable(); clusterState = ClusterState.builder(clusterState).routingTable(routingTable).build(); RoutingNodes routingNodes = clusterState.routingNodes(); diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/ClusterRebalanceRoutingTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/ClusterRebalanceRoutingTests.java index 89b07212078..4f3ffe173d6 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/ClusterRebalanceRoutingTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/ClusterRebalanceRoutingTests.java @@ -54,7 +54,7 @@ public class ClusterRebalanceRoutingTests extends ElasticsearchAllocationTestCas .addAsNew(metaData.index("test2")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); logger.info("start two nodes"); clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder().put(newNode("node1")).put(newNode("node2"))).build(); @@ -140,7 +140,7 @@ public class ClusterRebalanceRoutingTests extends ElasticsearchAllocationTestCas .addAsNew(metaData.index("test2")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); logger.info("start two nodes"); clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder().put(newNode("node1")).put(newNode("node2"))).build(); @@ -244,7 +244,7 @@ public class ClusterRebalanceRoutingTests extends ElasticsearchAllocationTestCas .addAsNew(metaData.index("test2")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); logger.info("start two nodes"); clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder().put(newNode("node1")).put(newNode("node2"))).build(); @@ -328,7 +328,7 @@ public class ClusterRebalanceRoutingTests extends ElasticsearchAllocationTestCas .addAsNew(metaData.index("test2")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); logger.info("start two nodes"); clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder().put(newNode("node1")).put(newNode("node2"))).build(); @@ -451,7 +451,7 @@ public class ClusterRebalanceRoutingTests extends ElasticsearchAllocationTestCas .addAsNew(metaData.index("test2")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); logger.info("start two nodes"); clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder().put(newNode("node1")).put(newNode("node2"))).build(); @@ -535,7 +535,7 @@ public class ClusterRebalanceRoutingTests extends ElasticsearchAllocationTestCas .addAsNew(metaData.index("test2")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); logger.info("start two nodes"); clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder().put(newNode("node1")).put(newNode("node2"))).build(); diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/ConcurrentRebalanceRoutingTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/ConcurrentRebalanceRoutingTests.java index 2f685b6173a..984cf26e061 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/ConcurrentRebalanceRoutingTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/ConcurrentRebalanceRoutingTests.java @@ -56,7 +56,7 @@ public class ConcurrentRebalanceRoutingTests extends ElasticsearchAllocationTest .addAsNew(metaData.index("test")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); assertThat(routingTable.index("test").shards().size(), equalTo(5)); for (int i = 0; i < routingTable.index("test").shards().size(); i++) { diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/DeadNodesAllocationTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/DeadNodesAllocationTests.java index fee78588a72..81f73d24691 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/DeadNodesAllocationTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/DeadNodesAllocationTests.java @@ -55,7 +55,7 @@ public class DeadNodesAllocationTests extends ElasticsearchAllocationTestCase { RoutingTable routingTable = RoutingTable.builder() .addAsNew(metaData.index("test")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); logger.info("--> adding 2 nodes on same rack and do rerouting"); clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder() @@ -107,7 +107,7 @@ public class DeadNodesAllocationTests extends ElasticsearchAllocationTestCase { RoutingTable routingTable = RoutingTable.builder() .addAsNew(metaData.index("test")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); logger.info("--> adding 2 nodes on same rack and do rerouting"); clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder() @@ -182,7 +182,7 @@ public class DeadNodesAllocationTests extends ElasticsearchAllocationTestCase { RoutingTable routingTable = RoutingTable.builder() .addAsNew(metaData.index("test")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); logger.info("--> adding 2 nodes on same rack and do rerouting"); clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder() diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/DisableAllocationTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/DisableAllocationTests.java index f58b3cb8ace..50f97e78527 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/DisableAllocationTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/DisableAllocationTests.java @@ -59,7 +59,7 @@ public class DisableAllocationTests extends ElasticsearchAllocationTestCase { .addAsNew(metaData.index("test")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); logger.info("--> adding two nodes and do rerouting"); clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder() @@ -88,7 +88,7 @@ public class DisableAllocationTests extends ElasticsearchAllocationTestCase { .addAsNew(metaData.index("test")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); logger.info("--> adding two nodes do rerouting"); clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder() @@ -121,7 +121,7 @@ public class DisableAllocationTests extends ElasticsearchAllocationTestCase { .addAsNew(metaData.index("enabled")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); logger.info("--> adding two nodes and do rerouting"); clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder() diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/ElectReplicaAsPrimaryDuringRelocationTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/ElectReplicaAsPrimaryDuringRelocationTests.java index 80d1a15e952..b1580225a36 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/ElectReplicaAsPrimaryDuringRelocationTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/ElectReplicaAsPrimaryDuringRelocationTests.java @@ -57,7 +57,7 @@ public class ElectReplicaAsPrimaryDuringRelocationTests extends ElasticsearchAll .addAsNew(metaData.index("test")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); logger.info("Adding two nodes and performing rerouting"); clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder().put(newNode("node1")).put(newNode("node2"))).build(); diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/FailedNodeRoutingTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/FailedNodeRoutingTests.java index e5ac3332989..0f4fd9515da 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/FailedNodeRoutingTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/FailedNodeRoutingTests.java @@ -55,7 +55,7 @@ public class FailedNodeRoutingTests extends ElasticsearchAllocationTestCase { .addAsNew(metaData.index("test2")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); logger.info("start 4 nodes"); clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder().put(newNode("node1")).put(newNode("node2")).put(newNode("node3")).put(newNode("node4"))).build(); @@ -115,7 +115,7 @@ public class FailedNodeRoutingTests extends ElasticsearchAllocationTestCase { .addAsNew(metaData.index("test2")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); logger.info("start 4 nodes"); clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder().put(newNode("node1")).put(newNode("node2")).put(newNode("node3")).put(newNode("node4"))).build(); diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/FailedShardsRoutingTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/FailedShardsRoutingTests.java index 38d331a8cf7..bf21cef731e 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/FailedShardsRoutingTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/FailedShardsRoutingTests.java @@ -59,7 +59,7 @@ public class FailedShardsRoutingTests extends ElasticsearchAllocationTestCase { RoutingTable routingTable = RoutingTable.builder() .addAsNew(metaData.index("test")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); logger.info("--> adding 2 nodes on same rack and do rerouting"); clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder() @@ -151,7 +151,7 @@ public class FailedShardsRoutingTests extends ElasticsearchAllocationTestCase { .addAsNew(metaData.index("test")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); logger.info("Adding two nodes and performing rerouting"); clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder().put(newNode("node1")).put(newNode("node2"))).build(); @@ -233,7 +233,7 @@ public class FailedShardsRoutingTests extends ElasticsearchAllocationTestCase { .addAsNew(metaData.index("test")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); logger.info("Adding single node and performing rerouting"); clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder().put(newNode("node1"))).build(); @@ -290,7 +290,7 @@ public class FailedShardsRoutingTests extends ElasticsearchAllocationTestCase { .addAsNew(metaData.index("test")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); logger.info("Adding two nodes and performing rerouting"); clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder().put(newNode("node1")).put(newNode("node2"))).build(); @@ -348,7 +348,7 @@ public class FailedShardsRoutingTests extends ElasticsearchAllocationTestCase { .addAsNew(metaData.index("test")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); logger.info("Adding two nodes and performing rerouting"); clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder().put(newNode("node1")).put(newNode("node2"))).build(); diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/FilterRoutingTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/FilterRoutingTests.java index b9e11a8310f..4790e87d519 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/FilterRoutingTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/FilterRoutingTests.java @@ -62,7 +62,7 @@ public class FilterRoutingTests extends ElasticsearchAllocationTestCase { .addAsNew(metaData.index("test")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); logger.info("--> adding four nodes and performing rerouting"); clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder() @@ -111,7 +111,7 @@ public class FilterRoutingTests extends ElasticsearchAllocationTestCase { .addAsNew(metaData.index("test")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); logger.info("--> adding two nodes and performing rerouting"); clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder() diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/IndexBalanceTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/IndexBalanceTests.java index 1536a12b186..bc133c83bfc 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/IndexBalanceTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/IndexBalanceTests.java @@ -58,7 +58,7 @@ public class IndexBalanceTests extends ElasticsearchAllocationTestCase { RoutingTable routingTable = RoutingTable.builder().addAsNew(metaData.index("test")).addAsNew(metaData.index("test1")).build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); assertThat(routingTable.index("test").shards().size(), equalTo(3)); for (int i = 0; i < routingTable.index("test").shards().size(); i++) { @@ -189,7 +189,7 @@ public class IndexBalanceTests extends ElasticsearchAllocationTestCase { RoutingTable routingTable = RoutingTable.builder().addAsNew(metaData.index("test")).addAsNew(metaData.index("test1")).build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); assertThat(routingTable.index("test").shards().size(), equalTo(3)); for (int i = 0; i < routingTable.index("test").shards().size(); i++) { @@ -351,7 +351,7 @@ public class IndexBalanceTests extends ElasticsearchAllocationTestCase { RoutingTable routingTable = RoutingTable.builder().addAsNew(metaData.index("test")).build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); assertThat(routingTable.index("test").shards().size(), equalTo(3)); for (int i = 0; i < routingTable.index("test").shards().size(); i++) { diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/NodeVersionAllocationDeciderTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/NodeVersionAllocationDeciderTests.java index 3c8874475ac..4040baa4bc5 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/NodeVersionAllocationDeciderTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/NodeVersionAllocationDeciderTests.java @@ -67,7 +67,7 @@ public class NodeVersionAllocationDeciderTests extends ElasticsearchAllocationTe .addAsNew(metaData.index("test")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); assertThat(routingTable.index("test").shards().size(), equalTo(5)); for (int i = 0; i < routingTable.index("test").shards().size(); i++) { @@ -187,7 +187,7 @@ public class NodeVersionAllocationDeciderTests extends ElasticsearchAllocationTe } RoutingTable routingTable = rtBuilder.build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); assertThat(routingTable.shardsWithState(UNASSIGNED).size(), equalTo(routingTable.allShards().size())); List nodes = new ArrayList<>(); int nodeIdx = 0; @@ -233,7 +233,7 @@ public class NodeVersionAllocationDeciderTests extends ElasticsearchAllocationTe .addAsNew(metaData.index("test")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); assertThat(routingTable.index("test").shards().size(), equalTo(5)); for (int i = 0; i < routingTable.index("test").shards().size(); i++) { diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/PreferLocalPrimariesToRelocatingPrimariesTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/PreferLocalPrimariesToRelocatingPrimariesTests.java index 2630527789f..d5b24850074 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/PreferLocalPrimariesToRelocatingPrimariesTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/PreferLocalPrimariesToRelocatingPrimariesTests.java @@ -60,7 +60,7 @@ public class PreferLocalPrimariesToRelocatingPrimariesTests extends Elasticsearc .addAsNew(metaData.index("test2")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); logger.info("adding two nodes and performing rerouting till all are allocated"); clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder() diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/PreferPrimaryAllocationTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/PreferPrimaryAllocationTests.java index f1cd54ad8b1..64408ef92bd 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/PreferPrimaryAllocationTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/PreferPrimaryAllocationTests.java @@ -59,7 +59,7 @@ public class PreferPrimaryAllocationTests extends ElasticsearchAllocationTestCas .addAsNew(metaData.index("test2")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); logger.info("adding two nodes and performing rerouting till all are allocated"); clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder().put(newNode("node1")).put(newNode("node2"))).build(); diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/PrimaryElectionRoutingTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/PrimaryElectionRoutingTests.java index 30ad4154ff9..847be37b0ef 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/PrimaryElectionRoutingTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/PrimaryElectionRoutingTests.java @@ -57,7 +57,7 @@ public class PrimaryElectionRoutingTests extends ElasticsearchAllocationTestCase .addAsNew(metaData.index("test")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); logger.info("Adding two nodes and performing rerouting"); clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder().put(newNode("node1")).put(newNode("node2"))).build(); @@ -108,7 +108,7 @@ public class PrimaryElectionRoutingTests extends ElasticsearchAllocationTestCase .addAsNew(metaData.index("test")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); logger.info("Adding two nodes and performing rerouting"); clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder().put(newNode("node1")).put(newNode("node2"))).build(); diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/PrimaryNotRelocatedWhileBeingRecoveredTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/PrimaryNotRelocatedWhileBeingRecoveredTests.java index ee47827bcf9..9854c383558 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/PrimaryNotRelocatedWhileBeingRecoveredTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/PrimaryNotRelocatedWhileBeingRecoveredTests.java @@ -60,7 +60,7 @@ public class PrimaryNotRelocatedWhileBeingRecoveredTests extends ElasticsearchAl .addAsNew(metaData.index("test")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); logger.info("Adding two nodes and performing rerouting"); clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder().put(newNode("node1"))).build(); diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/RandomAllocationDeciderTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/RandomAllocationDeciderTests.java index b1536154f00..f66704c7b69 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/RandomAllocationDeciderTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/RandomAllocationDeciderTests.java @@ -79,7 +79,7 @@ public class RandomAllocationDeciderTests extends ElasticsearchAllocationTestCas } RoutingTable routingTable = routingTableBuilder.build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); int numIters = scaledRandomIntBetween(10, 30); int nodeIdCounter = 0; int atMostNodes = between(Math.max(1, maxNumReplicas), numIters); diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/RebalanceAfterActiveTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/RebalanceAfterActiveTests.java index c3f91738d02..d076ca91cf5 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/RebalanceAfterActiveTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/RebalanceAfterActiveTests.java @@ -61,7 +61,7 @@ public class RebalanceAfterActiveTests extends ElasticsearchAllocationTestCase { .addAsNew(metaData.index("test")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); assertThat(routingTable.index("test").shards().size(), equalTo(5)); for (int i = 0; i < routingTable.index("test").shards().size(); i++) { diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/ReplicaAllocatedAfterPrimaryTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/ReplicaAllocatedAfterPrimaryTests.java index ad1180720a5..9aaffc795f4 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/ReplicaAllocatedAfterPrimaryTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/ReplicaAllocatedAfterPrimaryTests.java @@ -55,7 +55,7 @@ public class ReplicaAllocatedAfterPrimaryTests extends ElasticsearchAllocationTe .addAsNew(metaData.index("test")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); assertThat(routingTable.index("test").shards().size(), equalTo(1)); assertThat(routingTable.index("test").shard(0).size(), equalTo(2)); diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/RoutingNodesIntegrityTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/RoutingNodesIntegrityTests.java index c5454287079..334bf31d455 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/RoutingNodesIntegrityTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/RoutingNodesIntegrityTests.java @@ -59,7 +59,7 @@ public class RoutingNodesIntegrityTests extends ElasticsearchAllocationTestCase RoutingTable routingTable = RoutingTable.builder().addAsNew(metaData.index("test")).addAsNew(metaData.index("test1")).build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); RoutingNodes routingNodes = clusterState.routingNodes(); logger.info("Adding three node and performing rerouting"); @@ -132,7 +132,7 @@ public class RoutingNodesIntegrityTests extends ElasticsearchAllocationTestCase RoutingTable routingTable = RoutingTable.builder().addAsNew(metaData.index("test")).addAsNew(metaData.index("test1")).build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); logger.info("Adding one node and performing rerouting"); clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder().put(newNode("node1"))).build(); @@ -224,7 +224,7 @@ public class RoutingNodesIntegrityTests extends ElasticsearchAllocationTestCase RoutingTable routingTable = RoutingTable.builder().addAsNew(metaData.index("test")).build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); logger.info("Adding three node and performing rerouting"); clusterState = ClusterState.builder(clusterState) diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/SameShardRoutingTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/SameShardRoutingTests.java index c35959ca739..f75cf901a02 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/SameShardRoutingTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/SameShardRoutingTests.java @@ -60,7 +60,7 @@ public class SameShardRoutingTests extends ElasticsearchAllocationTestCase { RoutingTable routingTable = RoutingTable.builder() .addAsNew(metaData.index("test")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); logger.info("--> adding two nodes with the same host"); clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder() diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/ShardVersioningTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/ShardVersioningTests.java index e21246bbbcd..14825a59109 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/ShardVersioningTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/ShardVersioningTests.java @@ -53,7 +53,7 @@ public class ShardVersioningTests extends ElasticsearchAllocationTestCase { .addAsNew(metaData.index("test2")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); logger.info("start two nodes"); clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder().put(newNode("node1")).put(newNode("node2"))).build(); diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/ShardsLimitAllocationTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/ShardsLimitAllocationTests.java index 1086670e7db..1f863cbfa4c 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/ShardsLimitAllocationTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/ShardsLimitAllocationTests.java @@ -62,7 +62,7 @@ public class ShardsLimitAllocationTests extends ElasticsearchAllocationTestCase .addAsNew(metaData.index("test")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); logger.info("Adding two nodes and performing rerouting"); clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder().put(newNode("node1")).put(newNode("node2"))).build(); routingTable = strategy.reroute(clusterState).routingTable(); @@ -112,7 +112,7 @@ public class ShardsLimitAllocationTests extends ElasticsearchAllocationTestCase .addAsNew(metaData.index("test")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); logger.info("Adding one node and reroute"); clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder().put(newNode("node1"))).build(); routingTable = strategy.reroute(clusterState).routingTable(); diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/SingleShardNoReplicasRoutingTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/SingleShardNoReplicasRoutingTests.java index a72fd5b2802..db25d65c596 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/SingleShardNoReplicasRoutingTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/SingleShardNoReplicasRoutingTests.java @@ -64,7 +64,7 @@ public class SingleShardNoReplicasRoutingTests extends ElasticsearchAllocationTe .addAsNew(metaData.index("test")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); assertThat(routingTable.index("test").shards().size(), equalTo(1)); assertThat(routingTable.index("test").shard(0).size(), equalTo(1)); @@ -166,7 +166,7 @@ public class SingleShardNoReplicasRoutingTests extends ElasticsearchAllocationTe .addAsNew(metaData.index("test")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); assertThat(routingTable.index("test").shards().size(), equalTo(1)); assertThat(routingTable.index("test").shard(0).size(), equalTo(1)); @@ -224,7 +224,7 @@ public class SingleShardNoReplicasRoutingTests extends ElasticsearchAllocationTe routingTableBuilder.addAsNew(metaData.index("test" + i)); } RoutingTable routingTable = routingTableBuilder.build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); assertThat(routingTable.indicesRouting().size(), equalTo(numberOfIndices)); for (int i = 0; i < numberOfIndices; i++) { @@ -338,7 +338,7 @@ public class SingleShardNoReplicasRoutingTests extends ElasticsearchAllocationTe } RoutingTable routingTable = routingTableBuilder.build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); assertThat(routingTable.indicesRouting().size(), equalTo(numberOfIndices)); diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/SingleShardOneReplicaRoutingTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/SingleShardOneReplicaRoutingTests.java index 82dab0e2c97..203b8bb875b 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/SingleShardOneReplicaRoutingTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/SingleShardOneReplicaRoutingTests.java @@ -56,7 +56,7 @@ public class SingleShardOneReplicaRoutingTests extends ElasticsearchAllocationTe .addAsNew(metaData.index("test")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); assertThat(routingTable.index("test").shards().size(), equalTo(1)); assertThat(routingTable.index("test").shard(0).size(), equalTo(2)); diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/TenShardsOneReplicaRoutingTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/TenShardsOneReplicaRoutingTests.java index 897ae5f728c..d98605b380a 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/TenShardsOneReplicaRoutingTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/TenShardsOneReplicaRoutingTests.java @@ -63,7 +63,7 @@ public class TenShardsOneReplicaRoutingTests extends ElasticsearchAllocationTest .addAsNew(metaData.index("test")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); assertThat(routingTable.index("test").shards().size(), equalTo(10)); for (int i = 0; i < routingTable.index("test").shards().size(); i++) { diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/ThrottlingAllocationTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/ThrottlingAllocationTests.java index 64859c14786..c437d019349 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/ThrottlingAllocationTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/ThrottlingAllocationTests.java @@ -57,7 +57,7 @@ public class ThrottlingAllocationTests extends ElasticsearchAllocationTestCase { .addAsNew(metaData.index("test")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); logger.info("start one node, do reroute, only 3 should initialize"); clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder().put(newNode("node1"))).build(); @@ -118,7 +118,7 @@ public class ThrottlingAllocationTests extends ElasticsearchAllocationTestCase { .addAsNew(metaData.index("test")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); logger.info("start one node, do reroute, only 3 should initialize"); clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder().put(newNode("node1"))).build(); diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/UpdateNumberOfReplicasTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/UpdateNumberOfReplicasTests.java index fd792555d96..dac68615279 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/UpdateNumberOfReplicasTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/UpdateNumberOfReplicasTests.java @@ -55,7 +55,7 @@ public class UpdateNumberOfReplicasTests extends ElasticsearchAllocationTestCase .addAsNew(metaData.index("test")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); assertThat(routingTable.index("test").shards().size(), equalTo(1)); assertThat(routingTable.index("test").shard(0).size(), equalTo(2)); diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/DiskThresholdDeciderTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/DiskThresholdDeciderTests.java index b976982c327..68059120700 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/DiskThresholdDeciderTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/DiskThresholdDeciderTests.java @@ -92,7 +92,7 @@ public class DiskThresholdDeciderTests extends ElasticsearchAllocationTestCase { .addAsNew(metaData.index("test")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); logger.info("--> adding two nodes"); clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder() @@ -281,7 +281,7 @@ public class DiskThresholdDeciderTests extends ElasticsearchAllocationTestCase { .addAsNew(metaData.index("test")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); logger.info("--> adding two nodes"); clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder() @@ -467,7 +467,7 @@ public class DiskThresholdDeciderTests extends ElasticsearchAllocationTestCase { .addAsNew(metaData.index("test")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); logger.info("--> adding node1"); clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder() .put(newNode("node1")) @@ -529,7 +529,7 @@ public class DiskThresholdDeciderTests extends ElasticsearchAllocationTestCase { .addAsNew(metaData.index("test")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); logger.info("--> adding node1"); clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder() .put(newNode("node1")) diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/EnableAllocationTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/EnableAllocationTests.java index 595b25891c8..2791f13bc67 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/EnableAllocationTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/EnableAllocationTests.java @@ -59,7 +59,7 @@ public class EnableAllocationTests extends ElasticsearchAllocationTestCase { .addAsNew(metaData.index("test")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); logger.info("--> adding two nodes and do rerouting"); clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder() @@ -88,7 +88,7 @@ public class EnableAllocationTests extends ElasticsearchAllocationTestCase { .addAsNew(metaData.index("test")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); logger.info("--> adding two nodes do rerouting"); clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder() @@ -123,7 +123,7 @@ public class EnableAllocationTests extends ElasticsearchAllocationTestCase { .addAsNew(metaData.index("enabled")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); logger.info("--> adding two nodes and do rerouting"); clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder() diff --git a/src/test/java/org/elasticsearch/cluster/serialization/ClusterSerializationTests.java b/src/test/java/org/elasticsearch/cluster/serialization/ClusterSerializationTests.java index 505ccf22198..5db37fa67c9 100644 --- a/src/test/java/org/elasticsearch/cluster/serialization/ClusterSerializationTests.java +++ b/src/test/java/org/elasticsearch/cluster/serialization/ClusterSerializationTests.java @@ -49,7 +49,7 @@ public class ClusterSerializationTests extends ElasticsearchAllocationTestCase { DiscoveryNodes nodes = DiscoveryNodes.builder().put(newNode("node1")).put(newNode("node2")).put(newNode("node3")).localNodeId("node1").masterNodeId("node2").build(); - ClusterState clusterState = ClusterState.builder().nodes(nodes).metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).nodes(nodes).metaData(metaData).routingTable(routingTable).build(); AllocationService strategy = createAllocationService(); clusterState = ClusterState.builder(clusterState).routingTable(strategy.reroute(clusterState).routingTable()).build(); @@ -72,7 +72,7 @@ public class ClusterSerializationTests extends ElasticsearchAllocationTestCase { DiscoveryNodes nodes = DiscoveryNodes.builder().put(newNode("node1")).put(newNode("node2")).put(newNode("node3")).build(); - ClusterState clusterState = ClusterState.builder().nodes(nodes).metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).nodes(nodes).metaData(metaData).routingTable(routingTable).build(); AllocationService strategy = createAllocationService(); RoutingTable source = strategy.reroute(clusterState).routingTable(); diff --git a/src/test/java/org/elasticsearch/cluster/serialization/ClusterStateToStringTests.java b/src/test/java/org/elasticsearch/cluster/serialization/ClusterStateToStringTests.java index 4504b6bfb9f..9075c7e3594 100644 --- a/src/test/java/org/elasticsearch/cluster/serialization/ClusterStateToStringTests.java +++ b/src/test/java/org/elasticsearch/cluster/serialization/ClusterStateToStringTests.java @@ -50,7 +50,7 @@ public class ClusterStateToStringTests extends ElasticsearchAllocationTestCase { DiscoveryNodes nodes = DiscoveryNodes.builder().put(new DiscoveryNode("node_foo", DummyTransportAddress.INSTANCE, Version.CURRENT)).localNodeId("node_foo").masterNodeId("node_foo").build(); - ClusterState clusterState = ClusterState.builder().nodes(nodes).metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.DEFAULT).nodes(nodes).metaData(metaData).routingTable(routingTable).build(); AllocationService strategy = createAllocationService(); clusterState = ClusterState.builder(clusterState).routingTable(strategy.reroute(clusterState).routingTable()).build(); diff --git a/src/test/java/org/elasticsearch/cluster/structure/RoutingIteratorTests.java b/src/test/java/org/elasticsearch/cluster/structure/RoutingIteratorTests.java index 137a8bc7c72..82f929686ed 100644 --- a/src/test/java/org/elasticsearch/cluster/structure/RoutingIteratorTests.java +++ b/src/test/java/org/elasticsearch/cluster/structure/RoutingIteratorTests.java @@ -21,6 +21,7 @@ package org.elasticsearch.cluster.structure; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; +import org.elasticsearch.cluster.ClusterName; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.cluster.metadata.MetaData; @@ -262,7 +263,7 @@ public class RoutingIteratorTests extends ElasticsearchAllocationTestCase { .addAsNew(metaData.index("test")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder() .put(newNode("node1", ImmutableMap.of("rack_id", "rack_1", "zone", "zone1"))) @@ -311,7 +312,7 @@ public class RoutingIteratorTests extends ElasticsearchAllocationTestCase { .addAsNew(metaData.index("test")) .build(); - ClusterState clusterState = ClusterState.builder().metaData(metaData).routingTable(routingTable).build(); + ClusterState clusterState = ClusterState.builder(ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build(); clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder() .put(newNode("node1"))