-
Notifications
You must be signed in to change notification settings - Fork 24.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support "dry run" mode for updating Desired Nodes (#88305)
Add the dry_run query parameter to support simulating of updating of desired nodes. The update request will be validated, but no cluster state updates will be performed. In order to indicate that the response was a result of a dry run, we add the dry_run run field to the JSON representation of a response. See #82975
- Loading branch information
Showing
16 changed files
with
267 additions
and
33 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
pr: 88305 | ||
summary: Support "dry run" mode for updating Desired Nodes | ||
area: Distributed | ||
type: enhancement | ||
issues: [] |
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
107 changes: 107 additions & 0 deletions
107
...i-spec/src/yamlRestTest/resources/rest-api-spec/test/cluster.desired_nodes/20_dry_run.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,107 @@ | ||
--- | ||
setup: | ||
- skip: | ||
version: " - 8.3.99" | ||
reason: "Support for the dry run option was added in in 8.4.0" | ||
|
||
--- | ||
"Test dry run doesn't update empty desired nodes": | ||
- do: | ||
cluster.state: {} | ||
|
||
- set: { master_node: master } | ||
|
||
- do: | ||
nodes.info: {} | ||
- set: { nodes.$master.version: es_version } | ||
|
||
- do: | ||
_internal.update_desired_nodes: | ||
history_id: "test" | ||
version: 1 | ||
dry_run: true | ||
body: | ||
nodes: | ||
- { settings: { "node.name": "instance-000187" }, processors: 8.5, memory: "64gb", storage: "128gb", node_version: $es_version } | ||
- match: { replaced_existing_history_id: false } | ||
- match: { dry_run: true } | ||
|
||
- do: | ||
catch: missing | ||
_internal.get_desired_nodes: {} | ||
- match: { status: 404 } | ||
|
||
--- | ||
"Test dry run doesn't update existing desired nodes": | ||
- do: | ||
cluster.state: {} | ||
|
||
- set: { master_node: master } | ||
|
||
- do: | ||
nodes.info: {} | ||
- set: { nodes.$master.version: es_version } | ||
|
||
- do: | ||
_internal.update_desired_nodes: | ||
history_id: "test" | ||
version: 1 | ||
body: | ||
nodes: | ||
- { settings: { "node.name": "instance-000187" }, processors: 8.5, memory: "64gb", storage: "128gb", node_version: $es_version } | ||
- match: { replaced_existing_history_id: false } | ||
- match: { dry_run: false } | ||
|
||
- do: | ||
_internal.get_desired_nodes: {} | ||
- match: | ||
$body: | ||
history_id: "test" | ||
version: 1 | ||
nodes: | ||
- { settings: { node: { name: "instance-000187" } }, processors: 8.5, memory: "64gb", storage: "128gb", node_version: $es_version } | ||
|
||
- do: | ||
_internal.update_desired_nodes: | ||
history_id: "test" | ||
version: 2 | ||
dry_run: "true" | ||
body: | ||
nodes: | ||
- { settings: { "node.name": "instance-000187" }, processors: 8.5, memory: "64gb", storage: "128gb", node_version: $es_version } | ||
- { settings: { "node.name": "instance-000188" }, processors: 16.0, memory: "128gb", storage: "1tb", node_version: $es_version } | ||
- match: { replaced_existing_history_id: false } | ||
- match: { dry_run: true } | ||
|
||
- do: | ||
_internal.get_desired_nodes: { } | ||
- match: | ||
$body: | ||
history_id: "test" | ||
version: 1 | ||
nodes: | ||
- { settings: { node: { name: "instance-000187" } }, processors: 8.5, memory: "64gb", storage: "128gb", node_version: $es_version } | ||
--- | ||
"Test validation works for dry run updates": | ||
- do: | ||
cluster.state: { } | ||
|
||
- set: { master_node: master } | ||
|
||
- do: | ||
nodes.info: { } | ||
- set: { nodes.$master.version: es_version } | ||
|
||
- do: | ||
catch: bad_request | ||
_internal.update_desired_nodes: | ||
history_id: "test" | ||
version: 1 | ||
dry_run: "true" | ||
body: | ||
nodes: | ||
- { settings: { "node.external_id": "instance-000245", "random_setting": -42 }, processors: 16.0, memory: "128gb", storage: "1tb", node_version: $es_version } | ||
- match: { status: 400 } | ||
- match: { error.type: illegal_argument_exception } | ||
- match: { error.reason: "Nodes with ids [instance-000245] in positions [0] contain invalid settings" } | ||
- match: { error.suppressed.0.reason: "unknown setting [random_setting] please check that any required plugins are installed, or check the breaking changes documentation for removed settings" } |
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
Oops, something went wrong.