Skip to content

Commit

Permalink
Replace 'discovered_master' with 'discovered_cluster_manager' in 'GET…
Browse files Browse the repository at this point in the history
… 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 <[email protected]>
  • Loading branch information
Tianli Feng authored Mar 18, 2022
1 parent 1c2bdd8 commit ee04885
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -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: |
Expand All @@ -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":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,12 @@ protected Table getTableWithHeader(final RestRequest request) {
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");
Expand Down

0 comments on commit ee04885

Please sign in to comment.