[TEST] split base settings in ClusterDiscoveryConfiguration between node and transport client
The default settings that are currently applied to the transport client are about discovery and gateway, modules that are not even loaded on the transport client. We can now remove the local gateway as it's not the default one anyway. Also, make sure that the discovery setting is only applied to the node, as it is not relevant for transport client. Closes #8653
This commit is contained in:
parent
0c2fd314fc
commit
c2f1175692
|
@ -33,14 +33,11 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
public class ClusterDiscoveryConfiguration extends SettingsSource {
|
public class ClusterDiscoveryConfiguration extends SettingsSource {
|
||||||
|
|
||||||
public static Settings DEFAULT_SETTINGS = ImmutableSettings.settingsBuilder()
|
static Settings DEFAULT_NODE_SETTINGS = ImmutableSettings.settingsBuilder().put("discovery.type", "zen").build();
|
||||||
.put("gateway.type", "local")
|
|
||||||
.put("discovery.type", "zen")
|
|
||||||
.build();
|
|
||||||
|
|
||||||
final int numOfNodes;
|
final int numOfNodes;
|
||||||
|
final Settings nodeSettings;
|
||||||
final Settings baseSettings;
|
final Settings transportClientSettings;
|
||||||
|
|
||||||
public ClusterDiscoveryConfiguration(int numOfNodes) {
|
public ClusterDiscoveryConfiguration(int numOfNodes) {
|
||||||
this(numOfNodes, ImmutableSettings.EMPTY);
|
this(numOfNodes, ImmutableSettings.EMPTY);
|
||||||
|
@ -48,17 +45,18 @@ public class ClusterDiscoveryConfiguration extends SettingsSource {
|
||||||
|
|
||||||
public ClusterDiscoveryConfiguration(int numOfNodes, Settings extraSettings) {
|
public ClusterDiscoveryConfiguration(int numOfNodes, Settings extraSettings) {
|
||||||
this.numOfNodes = numOfNodes;
|
this.numOfNodes = numOfNodes;
|
||||||
this.baseSettings = ImmutableSettings.builder().put(DEFAULT_SETTINGS).put(extraSettings).build();
|
this.nodeSettings = ImmutableSettings.builder().put(DEFAULT_NODE_SETTINGS).put(extraSettings).build();
|
||||||
|
this.transportClientSettings = ImmutableSettings.builder().put(extraSettings).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Settings node(int nodeOrdinal) {
|
public Settings node(int nodeOrdinal) {
|
||||||
return baseSettings;
|
return nodeSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Settings transportClient() {
|
public Settings transportClient() {
|
||||||
return baseSettings;
|
return transportClientSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class UnicastZen extends ClusterDiscoveryConfiguration {
|
public static class UnicastZen extends ClusterDiscoveryConfiguration {
|
||||||
|
@ -120,7 +118,7 @@ public class ClusterDiscoveryConfiguration extends SettingsSource {
|
||||||
.put("discovery.zen.ping.multicast.enabled", false);
|
.put("discovery.zen.ping.multicast.enabled", false);
|
||||||
|
|
||||||
String[] unicastHosts = new String[unicastHostOrdinals.length];
|
String[] unicastHosts = new String[unicastHostOrdinals.length];
|
||||||
String mode = baseSettings.get("node.mode", InternalTestCluster.NODE_MODE);
|
String mode = nodeSettings.get("node.mode", InternalTestCluster.NODE_MODE);
|
||||||
if (mode.equals("local")) {
|
if (mode.equals("local")) {
|
||||||
builder.put(LocalTransport.TRANSPORT_LOCAL_ADDRESS, "node_" + nodeOrdinal);
|
builder.put(LocalTransport.TRANSPORT_LOCAL_ADDRESS, "node_" + nodeOrdinal);
|
||||||
for (int i = 0; i < unicastHosts.length; i++) {
|
for (int i = 0; i < unicastHosts.length; i++) {
|
||||||
|
|
Loading…
Reference in New Issue