Replace 'discovered_master' with 'discovered_cluster_manager' in 'GET Cat Health' API (#2438)

* Replace 'discovered_master' with 'discovered_cluster_manager' in the table header of `GET Cat Health` API, to promote inclusive language.
* Add `dcm` as the alias for the table header `discovered_cluster_manager`
* Add `discovered_master` as the alias for the table header `discovered_cluster_manager`, for keeping compatibility when using `GET _cat/nodes?v&h=discovered_master` to show the specific column only.
* Add YAML rest test

Signed-off-by: Tianli Feng <ftianli@amazon.com>
This commit is contained in:
Tianli Feng 2022-03-18 15:04:03 -07:00 committed by GitHub
parent 1c2bdd8642
commit ee048851f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 45 additions and 4 deletions

View File

@ -1,11 +1,19 @@
---
"Help":
"Help - before 2.0.0":
- skip:
version: " - 7.10.99"
reason: "discovered_master added in OpenSearch 1.0.0"
version: " - 7.10.99 , 2.0.0 - "
reason: "discovered_master added in OpenSearch 1.0.0, and renamed to discovered_cluster_manager in 2.0.0"
features: node_selector
- do:
cat.health:
help: true
node_selector:
# Only send request to nodes in <2.0 versions, especially during ':qa:mixed-cluster:v1.x.x#mixedClusterTest'.
# Because YAML REST test takes the minimum OpenSearch version in the cluster to apply the filter in 'skip' section,
# see OpenSearchClientYamlSuiteTestCase#initAndResetContext() for detail.
# During 'mixedClusterTest', the cluster can be mixed with nodes in 1.x and 2.x versions,
# so node_selector is required, and only filtering version in 'skip' is not enough.
version: "1.0.0 - 1.4.99"
- match:
$body: |
@ -27,6 +35,34 @@
$/
---
"Help":
- skip:
version: " - 1.4.99"
reason: "discovered_cluster_manager is added in OpenSearch 2.0.0"
- do:
cat.health:
help: true
- match:
$body: |
/^ epoch .+ \n
timestamp .+ \n
cluster .+ \n
status .+ \n
node.total .+ \n
node.data .+ \n
discovered_cluster_manager .+ \n
shards .+ \n
pri .+ \n
relo .+ \n
init .+ \n
unassign .+ \n
pending_tasks .+ \n
max_task_wait_time .+ \n
active_shards_percent .+ \n
$/
---
"Empty cluster":

View File

@ -88,7 +88,12 @@ public class RestHealthAction extends AbstractCatAction {
t.addCell("status", "alias:st;desc:health status");
t.addCell("node.total", "alias:nt,nodeTotal;text-align:right;desc:total number of nodes");
t.addCell("node.data", "alias:nd,nodeData;text-align:right;desc:number of nodes that can store data");
t.addCell("discovered_master", "alias:dm;text-align:right;desc:discovered master");
// TODO: Remove the header alias 'discovered_master', after removing MASTER_ROLE.
// The alias 'discovered_master' is added for compatibility when using request parameter 'h=discovered_master'.
t.addCell(
"discovered_cluster_manager",
"alias:dcm,dm,discovered_master;text-align:right;desc:cluster manager is discovered or not"
);
t.addCell("shards", "alias:t,sh,shards.total,shardsTotal;text-align:right;desc:total number of shards");
t.addCell("pri", "alias:p,shards.primary,shardsPrimary;text-align:right;desc:number of primary shards");
t.addCell("relo", "alias:r,shards.relocating,shardsRelocating;text-align:right;desc:number of relocating nodes");