Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
explain
flag support to the reroute API
By specifying the `explain` flag, an explanation for the reason a command can or cannot be executed is returned. No allocation commands are actually performed. Returns a response similar to: { "state": {...cluster state...}, "acknowledged": true, "explanations" : [ { "command" : "cancel", "parameters" : { "index" : "decide", "shard" : 0, "node" : "IvpoKRdtRiGrQ_WKtt4_4w", "allow_primary" : false }, "decisions" : [ { "decider" : "cancel_allocation_command", "decision" : "YES", "explanation" : "..." } ] }, { "command" : "move", "parameters" : { "index" : "decide", "shard" : 0, "from_node" : "IvpoKRdtRiGrQ_WKtt4_4w", "to_node" : "IvpoKRdtRiGrQ_WKtt4_4w" }, "decisions" : [ { "decider" : "same_shard", "decision" : "NO", "explanation" : "shard cannot be allocated on same node [IvpoKRdtRiGrQ_WKtt4_4w] it already exists on" }, etc ] }] } also removes AllocationExplanation from cluster state Closes #2483 Closes #5169
- Loading branch information
Showing
36 changed files
with
744 additions
and
201 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
setup: | ||
- do: | ||
indices.create: | ||
index: test_index | ||
body: | ||
settings: | ||
number_of_shards: "1" | ||
number_of_replicas: "0" | ||
|
||
- do: | ||
cluster.health: | ||
wait_for_status: green | ||
|
||
--- | ||
"Explain API with empty command list": | ||
|
||
- do: | ||
cluster.reroute: | ||
explain: true | ||
dry_run: true | ||
body: | ||
commands: [] | ||
|
||
- match: {explanations: []} | ||
|
||
--- | ||
"Explain API for non-existant node & shard": | ||
|
||
- do: | ||
cluster.reroute: | ||
explain: true | ||
dry_run: true | ||
body: | ||
commands: | ||
- cancel: | ||
index: test_index | ||
shard: 9 | ||
node: node_0 | ||
|
||
- match: {explanations.0.command: cancel} | ||
- match: | ||
explanations.0.parameters: | ||
index: test_index | ||
shard: 9 | ||
node: node_0 | ||
allow_primary: false | ||
- match: {explanations.0.decisions.0.decider: cancel_allocation_command} | ||
- match: {explanations.0.decisions.0.decision: "NO"} | ||
- is_true: explanations.0.decisions.0.explanation |
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
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.