From c6ba67d423a58dfba6088492cb04338f62ad8c9a Mon Sep 17 00:00:00 2001 From: Tianli Feng Date: Thu, 10 Mar 2022 20:21:50 -0800 Subject: [PATCH] Replace discovered_master with discovered_cluster_manager in cat health api Signed-off-by: Tianli Feng --- .../test/cat.health/10_basic.yml | 175 ++++++++++++------ .../rest/action/cat/RestHealthAction.java | 2 +- 2 files changed, 118 insertions(+), 59 deletions(-) diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/cat.health/10_basic.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/cat.health/10_basic.yml index 731fc5d166eca..5721ffba96754 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/cat.health/10_basic.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/cat.health/10_basic.yml @@ -1,89 +1,148 @@ --- "Help": - 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" - do: cat.health: help: true - match: $body: | - /^ epoch .+ \n - timestamp .+ \n - cluster .+ \n - status .+ \n - node.total .+ \n - node.data .+ \n - discovered_master .+ \n - shards .+ \n - pri .+ \n - relo .+ \n - init .+ \n - unassign .+ \n - pending_tasks .+ \n - max_task_wait_time .+ \n - active_shards_percent .+ \n - - $/ + /^ epoch .+ \n + timestamp .+ \n + cluster .+ \n + status .+ \n + node.total .+ \n + node.data .+ \n + discovered_master .+ \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": - skip: - version: " - 7.10.99" + version: " - 7.10.99 , 2.0.0 - " reason: "discovered_master added in OpenSearch 1.0.0" - do: cat.health: {} - match: $body: | - /^ - ( \d+ \s+ # epoch - \d\d:\d\d:\d\d \s+ # timestamp - \S+ \s+ # cluster - \w+ \s+ # status - \d+ \s+ # node.total - \d+ \s+ # node.data - \w+ \s+ # discovered_master - \d+ \s+ # shards - \d+ \s+ # pri - \d+ \s+ # relo - \d+ \s+ # init - \d+ \s+ # unassign - \d+ \s+ # pending_tasks - (-|\d+(?:[.]\d+)?m?s) \s+ # max task waiting time - \d+\.\d+% # active shards percent - \n - )+ - $/ + /^ + ( \d+ \s+ # epoch + \d\d:\d\d:\d\d \s+ # timestamp + \S+ \s+ # cluster + \w+ \s+ # status + \d+ \s+ # node.total + \d+ \s+ # node.data + \w+ \s+ # discovered_master + \d+ \s+ # shards + \d+ \s+ # pri + \d+ \s+ # relo + \d+ \s+ # init + \d+ \s+ # unassign + \d+ \s+ # pending_tasks + (-|\d+(?:[.]\d+)?m?s) \s+ # max task waiting time + \d+\.\d+% # active shards percent + \n + )+ + $/ + +--- +"Help - after 2.0.0": + - skip: + version: " - 1.4.99" + reason: "discovered_cluster_manager replaced the old terminology in 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 - after 2.0.0": + - skip: + version: " - 1.4.99" + reason: "discovered_cluster_manager replaced the old terminology in 2.0.0" + - do: + cat.health: {} + + - match: + $body: | + /^ + ( \d+ \s+ # epoch + \d\d:\d\d:\d\d \s+ # timestamp + \S+ \s+ # cluster + \w+ \s+ # status + \d+ \s+ # node.total + \d+ \s+ # node.data + \w+ \s+ # discovered_cluster_manager + \d+ \s+ # shards + \d+ \s+ # pri + \d+ \s+ # relo + \d+ \s+ # init + \d+ \s+ # unassign + \d+ \s+ # pending_tasks + (-|\d+(?:[.]\d+)?m?s) \s+ # max task waiting time + \d+\.\d+% # active shards percent + \n + )+ + $/ --- "With ts parameter": - skip: - version: " - 7.10.99" - reason: "discovered_master added in OpenSearch 1.0.0" + version: " - 1.4.99" + reason: "discovered_cluster_manager replaced the old terminology in 2.0.0" - do: cat.health: ts: false - match: $body: | - /^ - ( \S+ \s+ # cluster - \w+ \s+ # status - \d+ \s+ # node.total - \d+ \s+ # node.data - \w+ \s+ # discovered_master - \d+ \s+ # shards - \d+ \s+ # pri - \d+ \s+ # relo - \d+ \s+ # init - \d+ \s+ # unassign - \d+ \s+ # pending_tasks - (-|\d+(?:[.]\d+)?m?s) \s+ # max task waiting time - \d+\.\d+% # active shards percent - \n - )+ - $/ + /^ + ( \S+ \s+ # cluster + \w+ \s+ # status + \d+ \s+ # node.total + \d+ \s+ # node.data + \w+ \s+ # discovered_cluster_manager + \d+ \s+ # shards + \d+ \s+ # pri + \d+ \s+ # relo + \d+ \s+ # init + \d+ \s+ # unassign + \d+ \s+ # pending_tasks + (-|\d+(?:[.]\d+)?m?s) \s+ # max task waiting time + \d+\.\d+% # active shards percent + \n + )+ + $/ diff --git a/server/src/main/java/org/opensearch/rest/action/cat/RestHealthAction.java b/server/src/main/java/org/opensearch/rest/action/cat/RestHealthAction.java index b6e945620f918..d43b512e77802 100644 --- a/server/src/main/java/org/opensearch/rest/action/cat/RestHealthAction.java +++ b/server/src/main/java/org/opensearch/rest/action/cat/RestHealthAction.java @@ -88,7 +88,7 @@ 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"); + t.addCell("discovered_cluster_manager", "alias:dm;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");