Skip to content

Rename the remote connection mode simple to proxy #50291

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public void setupRemoteClusterConfig() throws Exception {
String transportAddress = (String) nodesResponse.get("transport_address");

ClusterUpdateSettingsRequest updateSettingsRequest = new ClusterUpdateSettingsRequest();
updateSettingsRequest.transientSettings(Collections.singletonMap("cluster.remote.local_cluster.sniff.seeds", transportAddress));
updateSettingsRequest.transientSettings(Collections.singletonMap("cluster.remote.local_cluster.seeds", transportAddress));
ClusterUpdateSettingsResponse updateSettingsResponse =
highLevelClient().cluster().putSettings(updateSettingsRequest, RequestOptions.DEFAULT);
assertThat(updateSettingsResponse.isAcknowledged(), is(true));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public void setupRemoteClusterConfig() throws IOException {
String transportAddress = (String) nodesResponse.get("transport_address");

ClusterUpdateSettingsRequest updateSettingsRequest = new ClusterUpdateSettingsRequest();
updateSettingsRequest.transientSettings(Collections.singletonMap("cluster.remote.local.sniff.seeds", transportAddress));
updateSettingsRequest.transientSettings(Collections.singletonMap("cluster.remote.local.seeds", transportAddress));
ClusterUpdateSettingsResponse updateSettingsResponse =
client.cluster().putSettings(updateSettingsRequest, RequestOptions.DEFAULT);
assertThat(updateSettingsResponse.isAcknowledged(), is(true));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public void testSearchSkipUnavailable() throws IOException {
try (MockTransportService remoteTransport = startTransport("node0", new CopyOnWriteArrayList<>(), Version.CURRENT, threadPool)) {
DiscoveryNode remoteNode = remoteTransport.getLocalDiscoNode();

updateRemoteClusterSettings(Collections.singletonMap("sniff.seeds", remoteNode.getAddress().toString()));
updateRemoteClusterSettings(Collections.singletonMap("seeds", remoteNode.getAddress().toString()));

for (int i = 0; i < 10; i++) {
restHighLevelClient.index(
Expand Down Expand Up @@ -229,7 +229,7 @@ public void testSearchSkipUnavailable() throws IOException {
assertSearchConnectFailure();

Map<String, Object> map = new HashMap<>();
map.put("sniff.seeds", null);
map.put("seeds", null);
map.put("skip_unavailable", null);
updateRemoteClusterSettings(map);
}
Expand All @@ -248,32 +248,32 @@ public void testSkipUnavailableDependsOnSeeds() throws IOException {
() -> client().performRequest(request));
assertEquals(400, responseException.getResponse().getStatusLine().getStatusCode());
assertThat(responseException.getMessage(),
containsString("missing required setting [cluster.remote.remote1.sniff.seeds] " +
containsString("missing required setting [cluster.remote.remote1.seeds] " +
"for setting [cluster.remote.remote1.skip_unavailable]"));
}

Map<String, Object> settingsMap = new HashMap<>();
settingsMap.put("sniff.seeds", remoteNode.getAddress().toString());
settingsMap.put("seeds", remoteNode.getAddress().toString());
settingsMap.put("skip_unavailable", randomBoolean());
updateRemoteClusterSettings(settingsMap);

{
//check that seeds cannot be reset alone if skip_unavailable is set
Request request = new Request("PUT", "/_cluster/settings");
request.setEntity(buildUpdateSettingsRequestBody(Collections.singletonMap("sniff.seeds", null)));
request.setEntity(buildUpdateSettingsRequestBody(Collections.singletonMap("seeds", null)));
ResponseException responseException = expectThrows(ResponseException.class,
() -> client().performRequest(request));
assertEquals(400, responseException.getResponse().getStatusLine().getStatusCode());
assertThat(responseException.getMessage(), containsString("missing required setting [cluster.remote.remote1.sniff.seeds] " +
assertThat(responseException.getMessage(), containsString("missing required setting [cluster.remote.remote1.seeds] " +
"for setting [cluster.remote.remote1.skip_unavailable]"));
}

if (randomBoolean()) {
updateRemoteClusterSettings(Collections.singletonMap("skip_unavailable", null));
updateRemoteClusterSettings(Collections.singletonMap("sniff.seeds", null));
updateRemoteClusterSettings(Collections.singletonMap("seeds", null));
} else {
Map<String, Object> nullMap = new HashMap<>();
nullMap.put("sniff.seeds", null);
nullMap.put("seeds", null);
nullMap.put("skip_unavailable", null);
updateRemoteClusterSettings(nullMap);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
"Add transient remote cluster in simple mode with invalid sniff settings":
"Add transient remote cluster in proxy mode with invalid sniff settings":
- do:
cluster.get_settings:
include_defaults: true
Expand All @@ -12,32 +12,32 @@
flat_settings: true
body:
transient:
cluster.remote.test_remote_cluster.mode: "simple"
cluster.remote.test_remote_cluster.sniff.node_connections: "5"
cluster.remote.test_remote_cluster.simple.addresses: $remote_ip
cluster.remote.test_remote_cluster.mode: "proxy"
cluster.remote.test_remote_cluster.node_connections: "5"
cluster.remote.test_remote_cluster.proxy_addresses: $remote_ip

- match: { status: 400 }
- match: { error.root_cause.0.type: "illegal_argument_exception" }
- match: { error.root_cause.0.reason: "Setting \"cluster.remote.test_remote_cluster.sniff.node_connections\" cannot be
used with the configured \"cluster.remote.test_remote_cluster.mode\" [required=SNIFF, configured=SIMPLE]" }
- match: { error.root_cause.0.reason: "Setting \"cluster.remote.test_remote_cluster.node_connections\" cannot be
used with the configured \"cluster.remote.test_remote_cluster.mode\" [required=SNIFF, configured=PROXY]" }

- do:
catch: bad_request
cluster.put_settings:
flat_settings: true
body:
transient:
cluster.remote.test_remote_cluster.mode: "simple"
cluster.remote.test_remote_cluster.sniff.seeds: $remote_ip
cluster.remote.test_remote_cluster.simple.addresses: $remote_ip
cluster.remote.test_remote_cluster.mode: "proxy"
cluster.remote.test_remote_cluster.seeds: $remote_ip
cluster.remote.test_remote_cluster.proxy_addresses: $remote_ip

- match: { status: 400 }
- match: { error.root_cause.0.type: "illegal_argument_exception" }
- match: { error.root_cause.0.reason: "Setting \"cluster.remote.test_remote_cluster.sniff.seeds\" cannot be
used with the configured \"cluster.remote.test_remote_cluster.mode\" [required=SNIFF, configured=SIMPLE]" }
- match: { error.root_cause.0.reason: "Setting \"cluster.remote.test_remote_cluster.seeds\" cannot be
used with the configured \"cluster.remote.test_remote_cluster.mode\" [required=SNIFF, configured=PROXY]" }

---
"Add transient remote cluster in sniff mode with invalid simple settings":
"Add transient remote cluster in sniff mode with invalid proxy settings":
- do:
cluster.get_settings:
include_defaults: true
Expand All @@ -50,30 +50,30 @@
flat_settings: true
body:
transient:
cluster.remote.test_remote_cluster.simple.socket_connections: "20"
cluster.remote.test_remote_cluster.sniff.seeds: $remote_ip
cluster.remote.test_remote_cluster.proxy_socket_connections: "20"
cluster.remote.test_remote_cluster.seeds: $remote_ip

- match: { status: 400 }
- match: { error.root_cause.0.type: "illegal_argument_exception" }
- match: { error.root_cause.0.reason: "Setting \"cluster.remote.test_remote_cluster.simple.socket_connections\" cannot be
used with the configured \"cluster.remote.test_remote_cluster.mode\" [required=SIMPLE, configured=SNIFF]" }
- match: { error.root_cause.0.reason: "Setting \"cluster.remote.test_remote_cluster.proxy_socket_connections\" cannot be
used with the configured \"cluster.remote.test_remote_cluster.mode\" [required=PROXY, configured=SNIFF]" }

- do:
catch: bad_request
cluster.put_settings:
flat_settings: true
body:
transient:
cluster.remote.test_remote_cluster.simple.addresses: $remote_ip
cluster.remote.test_remote_cluster.sniff.seeds: $remote_ip
cluster.remote.test_remote_cluster.proxy_addresses: $remote_ip
cluster.remote.test_remote_cluster.seeds: $remote_ip

- match: { status: 400 }
- match: { error.root_cause.0.type: "illegal_argument_exception" }
- match: { error.root_cause.0.reason: "Setting \"cluster.remote.test_remote_cluster.simple.addresses\" cannot be
used with the configured \"cluster.remote.test_remote_cluster.mode\" [required=SIMPLE, configured=SNIFF]" }
- match: { error.root_cause.0.reason: "Setting \"cluster.remote.test_remote_cluster.proxy_addresses\" cannot be
used with the configured \"cluster.remote.test_remote_cluster.mode\" [required=PROXY, configured=SNIFF]" }

---
"Add transient remote cluster using simple connection mode using valid settings":
"Add transient remote cluster using proxy connection mode using valid settings":
- do:
cluster.get_settings:
include_defaults: true
Expand All @@ -85,13 +85,13 @@
flat_settings: true
body:
transient:
cluster.remote.test_remote_cluster.mode: "simple"
cluster.remote.test_remote_cluster.simple.socket_connections: "3"
cluster.remote.test_remote_cluster.simple.addresses: $remote_ip
cluster.remote.test_remote_cluster.mode: "proxy"
cluster.remote.test_remote_cluster.proxy_socket_connections: "3"
cluster.remote.test_remote_cluster.proxy_addresses: $remote_ip

- match: {transient.cluster\.remote\.test_remote_cluster\.mode: "simple"}
- match: {transient.cluster\.remote\.test_remote_cluster\.simple\.socket_connections: "3"}
- match: {transient.cluster\.remote\.test_remote_cluster\.simple\.addresses: $remote_ip}
- match: {transient.cluster\.remote\.test_remote_cluster\.mode: "proxy"}
- match: {transient.cluster\.remote\.test_remote_cluster\.proxy_socket_connections: "3"}
- match: {transient.cluster\.remote\.test_remote_cluster\.proxy_addresses: $remote_ip}

- do:
search:
Expand Down Expand Up @@ -120,12 +120,12 @@
body:
transient:
cluster.remote.test_remote_cluster.mode: "sniff"
cluster.remote.test_remote_cluster.sniff.node_connections: "3"
cluster.remote.test_remote_cluster.sniff.seeds: $remote_ip
cluster.remote.test_remote_cluster.node_connections: "3"
cluster.remote.test_remote_cluster.seeds: $remote_ip

- match: {transient.cluster\.remote\.test_remote_cluster\.mode: "sniff"}
- match: {transient.cluster\.remote\.test_remote_cluster\.sniff\.node_connections: "3"}
- match: {transient.cluster\.remote\.test_remote_cluster\.sniff\.seeds: $remote_ip}
- match: {transient.cluster\.remote\.test_remote_cluster\.node_connections: "3"}
- match: {transient.cluster\.remote\.test_remote_cluster\.seeds: $remote_ip}

- do:
search:
Expand Down Expand Up @@ -154,10 +154,10 @@
body:
transient:
cluster.remote.test_remote_cluster.mode: "sniff"
cluster.remote.test_remote_cluster.sniff.seeds: $remote_ip
cluster.remote.test_remote_cluster.seeds: $remote_ip

- match: {transient.cluster\.remote\.test_remote_cluster\.mode: "sniff"}
- match: {transient.cluster\.remote\.test_remote_cluster\.sniff\.seeds: $remote_ip}
- match: {transient.cluster\.remote\.test_remote_cluster\.seeds: $remote_ip}

- do:
search:
Expand All @@ -178,25 +178,25 @@
flat_settings: true
body:
transient:
cluster.remote.test_remote_cluster.mode: "simple"
cluster.remote.test_remote_cluster.simple.addresses: $remote_ip
cluster.remote.test_remote_cluster.mode: "proxy"
cluster.remote.test_remote_cluster.proxy_addresses: $remote_ip

- match: { status: 400 }
- match: { error.root_cause.0.type: "illegal_argument_exception" }
- match: { error.root_cause.0.reason: "Setting \"cluster.remote.test_remote_cluster.sniff.seeds\" cannot be
used with the configured \"cluster.remote.test_remote_cluster.mode\" [required=SNIFF, configured=SIMPLE]" }
- match: { error.root_cause.0.reason: "Setting \"cluster.remote.test_remote_cluster.seeds\" cannot be
used with the configured \"cluster.remote.test_remote_cluster.mode\" [required=SNIFF, configured=PROXY]" }

- do:
cluster.put_settings:
flat_settings: true
body:
transient:
cluster.remote.test_remote_cluster.mode: "simple"
cluster.remote.test_remote_cluster.sniff.seeds: null
cluster.remote.test_remote_cluster.simple.addresses: $remote_ip
cluster.remote.test_remote_cluster.mode: "proxy"
cluster.remote.test_remote_cluster.seeds: null
cluster.remote.test_remote_cluster.proxy_addresses: $remote_ip

- match: {transient.cluster\.remote\.test_remote_cluster\.mode: "simple"}
- match: {transient.cluster\.remote\.test_remote_cluster\.simple\.addresses: $remote_ip}
- match: {transient.cluster\.remote\.test_remote_cluster\.mode: "proxy"}
- match: {transient.cluster\.remote\.test_remote_cluster\.proxy_addresses: $remote_ip}

- do:
search:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
body:
transient:
cluster.remote.test_remote_cluster.mode: "sniff"
cluster.remote.test_remote_cluster.sniff.node_connections: "2"
cluster.remote.test_remote_cluster.sniff.seeds: $remote_ip
cluster.remote.test_remote_cluster.node_connections: "2"
cluster.remote.test_remote_cluster.seeds: $remote_ip

- match: {transient.cluster\.remote\.test_remote_cluster\.mode: "sniff"}
- match: {transient.cluster\.remote\.test_remote_cluster\.sniff\.node_connections: "2"}
- match: {transient.cluster\.remote\.test_remote_cluster\.sniff\.seeds: $remote_ip}
- match: {transient.cluster\.remote\.test_remote_cluster\.node_connections: "2"}
- match: {transient.cluster\.remote\.test_remote_cluster\.seeds: $remote_ip}

# we do another search here since this will enforce the connection to be established
# otherwise the cluster might not have been connected yet.
Expand Down Expand Up @@ -66,15 +66,15 @@
flat_settings: true
body:
transient:
cluster.remote.test_remote_cluster.mode: "simple"
cluster.remote.test_remote_cluster.sniff.seeds: null
cluster.remote.test_remote_cluster.sniff.node_connections: null
cluster.remote.test_remote_cluster.simple.socket_connections: "10"
cluster.remote.test_remote_cluster.simple.addresses: $remote_ip
cluster.remote.test_remote_cluster.mode: "proxy"
cluster.remote.test_remote_cluster.seeds: null
cluster.remote.test_remote_cluster.node_connections: null
cluster.remote.test_remote_cluster.proxy_socket_connections: "10"
cluster.remote.test_remote_cluster.proxy_addresses: $remote_ip

- match: {transient.cluster\.remote\.test_remote_cluster\.mode: "simple"}
- match: {transient.cluster\.remote\.test_remote_cluster\.simple\.socket_connections: "10"}
- match: {transient.cluster\.remote\.test_remote_cluster\.simple\.addresses: $remote_ip}
- match: {transient.cluster\.remote\.test_remote_cluster\.mode: "proxy"}
- match: {transient.cluster\.remote\.test_remote_cluster\.proxy_socket_connections: "10"}
- match: {transient.cluster\.remote\.test_remote_cluster\.proxy_addresses: $remote_ip}

- do:
cluster.remote_info: {}
Expand All @@ -84,15 +84,15 @@
- gt: { test_remote_cluster.num_sockets_connected: 0}
- match: { test_remote_cluster.max_socket_connections: 10}
- match: { test_remote_cluster.initial_connect_timeout: "30s" }
- match: { test_remote_cluster.mode: "simple" }
- match: { test_remote_cluster.mode: "proxy" }

- do:
cluster.put_settings:
body:
transient:
cluster.remote.test_remote_cluster.mode: null
cluster.remote.test_remote_cluster.simple.socket_connections: null
cluster.remote.test_remote_cluster.simple.addresses: null
cluster.remote.test_remote_cluster.proxy_socket_connections: null
cluster.remote.test_remote_cluster.proxy_addresses: null

---
"skip_unavailable is returned as part of _remote/info response":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.transport.RemoteClusterService;
import org.elasticsearch.transport.RemoteConnectionStrategy;
import org.elasticsearch.transport.SimpleConnectionStrategy;
import org.elasticsearch.transport.ProxyConnectionStrategy;
import org.elasticsearch.transport.SniffConnectionStrategy;
import org.elasticsearch.transport.TransportSettings;
import org.elasticsearch.watcher.ResourceWatcherService;
Expand Down Expand Up @@ -293,10 +293,9 @@ public void apply(Settings value, Settings current, Settings previous) {
RemoteClusterService.REMOTE_CLUSTER_PING_SCHEDULE,
RemoteClusterService.REMOTE_CLUSTER_COMPRESS,
RemoteConnectionStrategy.REMOTE_CONNECTION_MODE,
SimpleConnectionStrategy.REMOTE_CLUSTER_ADDRESSES,
SimpleConnectionStrategy.REMOTE_SOCKET_CONNECTIONS,
SimpleConnectionStrategy.INCLUDE_SERVER_NAME,
SniffConnectionStrategy.REMOTE_CLUSTER_SEEDS_OLD,
ProxyConnectionStrategy.REMOTE_CLUSTER_ADDRESSES,
ProxyConnectionStrategy.REMOTE_SOCKET_CONNECTIONS,
ProxyConnectionStrategy.INCLUDE_SERVER_NAME,
SniffConnectionStrategy.REMOTE_CLUSTERS_PROXY,
SniffConnectionStrategy.REMOTE_CLUSTER_SEEDS,
SniffConnectionStrategy.REMOTE_NODE_CONNECTIONS,
Expand Down
Loading