-
Notifications
You must be signed in to change notification settings - Fork 24.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable simple remote connection strategy (#49561)
This commit back ports three commits related to enabling the simple connection strategy. Allow simple connection strategy to be configured (#49066) Currently the simple connection strategy only exists in the code. It cannot be configured. This commit moves in the direction of allowing it to be configured. It introduces settings for the addresses and socket count. Additionally it introduces new settings for the sniff strategy so that the more generic number of connections and seed node settings can be deprecated. The simple settings are not yet registered as the registration is dependent on follow-up work to validate the settings. Ensure at least 1 seed configured in remote test (#49389) This fixes #49384. Currently when we select a random subset of seed nodes from a list, it is possible for 0 seeds to be selected. This test depends on at least 1 seed being selected. Add the simple strategy to cluster settings (#49414) This is related to #49067. This commit adds the simple connection strategy settings and strategy mode setting to the cluster settings registry. With these changes, the simple connection mode can be used. Additionally, it adds validation to ensure that settings cannot be misconfigured.
- Loading branch information
1 parent
99e3136
commit 416178c
Showing
27 changed files
with
1,184 additions
and
511 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
212 changes: 212 additions & 0 deletions
212
...src/test/resources/rest-api-spec/test/multi_cluster/100_connection_mode_configuration.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,212 @@ | ||
--- | ||
"Add transient remote cluster in simple mode with invalid sniff settings": | ||
- do: | ||
cluster.get_settings: | ||
include_defaults: true | ||
|
||
- set: { defaults.cluster.remote.my_remote_cluster.seeds.0: remote_ip } | ||
|
||
- 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.node_connections: "5" | ||
cluster.remote.test_remote_cluster.simple.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]" } | ||
|
||
- 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 | ||
|
||
- 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]" } | ||
|
||
--- | ||
"Add transient remote cluster in sniff mode with invalid simple settings": | ||
- do: | ||
cluster.get_settings: | ||
include_defaults: true | ||
|
||
- set: { defaults.cluster.remote.my_remote_cluster.seeds.0: remote_ip } | ||
|
||
- do: | ||
catch: bad_request | ||
cluster.put_settings: | ||
flat_settings: true | ||
body: | ||
transient: | ||
cluster.remote.test_remote_cluster.simple.socket_connections: "20" | ||
cluster.remote.test_remote_cluster.sniff.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]" } | ||
|
||
- 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 | ||
|
||
- 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]" } | ||
|
||
--- | ||
"Add transient remote cluster using simple connection mode using valid settings": | ||
- do: | ||
cluster.get_settings: | ||
include_defaults: true | ||
|
||
- set: { defaults.cluster.remote.my_remote_cluster.seeds.0: remote_ip } | ||
|
||
- do: | ||
cluster.put_settings: | ||
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 | ||
|
||
- 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} | ||
|
||
- do: | ||
search: | ||
rest_total_hits_as_int: true | ||
index: test_remote_cluster:test_index | ||
|
||
- is_false: num_reduce_phases | ||
- match: {_clusters.total: 1} | ||
- match: {_clusters.successful: 1} | ||
- match: {_clusters.skipped: 0} | ||
- match: { _shards.total: 3 } | ||
- match: { hits.total: 6 } | ||
- match: { hits.hits.0._index: "test_remote_cluster:test_index" } | ||
|
||
--- | ||
"Add transient remote cluster using sniff connection mode using valid settings": | ||
- do: | ||
cluster.get_settings: | ||
include_defaults: true | ||
|
||
- set: { defaults.cluster.remote.my_remote_cluster.seeds.0: remote_ip } | ||
|
||
- do: | ||
cluster.put_settings: | ||
flat_settings: true | ||
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 | ||
|
||
- 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} | ||
|
||
- do: | ||
search: | ||
rest_total_hits_as_int: true | ||
index: test_remote_cluster:test_index | ||
|
||
- is_false: num_reduce_phases | ||
- match: {_clusters.total: 1} | ||
- match: {_clusters.successful: 1} | ||
- match: {_clusters.skipped: 0} | ||
- match: { _shards.total: 3 } | ||
- match: { hits.total: 6 } | ||
- match: { hits.hits.0._index: "test_remote_cluster:test_index" } | ||
|
||
--- | ||
"Switch connection mode for configured cluster": | ||
- do: | ||
cluster.get_settings: | ||
include_defaults: true | ||
|
||
- set: { defaults.cluster.remote.my_remote_cluster.seeds.0: remote_ip } | ||
|
||
- do: | ||
cluster.put_settings: | ||
flat_settings: true | ||
body: | ||
transient: | ||
cluster.remote.test_remote_cluster.mode: "sniff" | ||
cluster.remote.test_remote_cluster.sniff.seeds: $remote_ip | ||
|
||
- match: {transient.cluster\.remote\.test_remote_cluster\.mode: "sniff"} | ||
- match: {transient.cluster\.remote\.test_remote_cluster\.sniff\.seeds: $remote_ip} | ||
|
||
- do: | ||
search: | ||
rest_total_hits_as_int: true | ||
index: test_remote_cluster:test_index | ||
|
||
- is_false: num_reduce_phases | ||
- match: {_clusters.total: 1} | ||
- match: {_clusters.successful: 1} | ||
- match: {_clusters.skipped: 0} | ||
- match: { _shards.total: 3 } | ||
- match: { hits.total: 6 } | ||
- match: { hits.hits.0._index: "test_remote_cluster:test_index" } | ||
|
||
- do: | ||
catch: bad_request | ||
cluster.put_settings: | ||
flat_settings: true | ||
body: | ||
transient: | ||
cluster.remote.test_remote_cluster.mode: "simple" | ||
cluster.remote.test_remote_cluster.simple.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]" } | ||
|
||
- 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 | ||
|
||
- match: {transient.cluster\.remote\.test_remote_cluster\.mode: "simple"} | ||
- match: {transient.cluster\.remote\.test_remote_cluster\.simple\.addresses: $remote_ip} | ||
|
||
- do: | ||
search: | ||
rest_total_hits_as_int: true | ||
index: test_remote_cluster:test_index | ||
|
||
- is_false: num_reduce_phases | ||
- match: {_clusters.total: 1} | ||
- match: {_clusters.successful: 1} | ||
- match: {_clusters.skipped: 0} | ||
- match: { _shards.total: 3 } | ||
- match: { hits.total: 6 } | ||
- match: { hits.hits.0._index: "test_remote_cluster:test_index" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.