-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Add a new REST API endpoint 'GET _cat/cluster_manager' as the replacement of 'GET _cat/master' #2404
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a new REST API endpoint 'GET _cat/cluster_manager' as the replacement of 'GET _cat/master' #2404
Changes from all commits
a0c43a3
b23c566
a33d574
bb79c85
c6fe237
5a751e6
c9c1a0b
be44736
00a6ff6
466b083
a17afa7
c46e535
0b7b236
300f18b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,27 @@ | ||
| { | ||
| "cat.master":{ | ||
| "cat.cluster_manager":{ | ||
| "documentation":{ | ||
| "url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-master.html", | ||
| "description":"Returns information about the master node." | ||
| "url":"https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-master/", | ||
| "description":"Returns information about the cluster-manager node." | ||
| }, | ||
| "stability":"stable", | ||
| "url":{ | ||
| "paths":[ | ||
| { | ||
| "path":"/_cat/master", | ||
| "path":"/_cat/cluster_manager", | ||
| "methods":[ | ||
| "GET" | ||
| ] | ||
| }, | ||
| { | ||
| "path":"/_cat/master", | ||
| "methods":[ | ||
| "GET" | ||
| ], | ||
| "deprecated":{ | ||
| "version":"2.0.0", | ||
| "description":"To promote inclusive language, please use '/_cat/cluster_manager' instead." | ||
| } | ||
| } | ||
| ] | ||
| }, | ||
|
|
@@ -22,7 +32,7 @@ | |
| }, | ||
| "local":{ | ||
| "type":"boolean", | ||
| "description":"Return local information, do not retrieve the state from master node (default: false)" | ||
| "description":"Return local information, do not retrieve the state from cluster-manager node (default: false)" | ||
| }, | ||
| "master_timeout":{ | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't this parameter name be changed to be inclusive?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmmm, good question. I didn't think of it at that time. Since the deprecation of the parameter "master_timeout" will be handled in separate PR, maybe it is fair to keep it for now. 🙂
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we should introduce a new API with old parameter names. If a client moves to the I would rather we use inclusive naming from the get-go in net-new APIs and code paths.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I got it. 😄 Make sense not to introduce a new API with out-dated parameter name.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I modified the code to:
If I should deprecate the request parameter
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 please add an issue so we don't miss out on it
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| "type":"time", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| setup: | ||
| - skip: | ||
| features: allowed_warnings | ||
|
|
||
| --- | ||
| "Help": | ||
| - skip: | ||
| version: " - 1.4.99" | ||
| reason: "path _cat/cluster_manager is introduced in 2.0.0" | ||
|
|
||
| - do: | ||
| cat.cluster_manager: | ||
| help: true | ||
| allowed_warnings: | ||
| - '[GET /_cat/master] is deprecated! Use [GET /_cat/cluster_manager] instead.' | ||
|
|
||
| - match: | ||
| $body: | | ||
| /^ id .+ \n | ||
| host .+ \n | ||
| ip .+ \n | ||
| node .+ \n | ||
|
|
||
| $/ | ||
|
|
||
| --- | ||
| "Test cat cluster_manager output": | ||
| - skip: | ||
| version: " - 1.4.99" | ||
| reason: "path _cat/cluster_manager is introduced in 2.0.0" | ||
|
|
||
| - do: | ||
| cat.cluster_manager: {} | ||
| allowed_warnings: | ||
| - '[GET /_cat/master] is deprecated! Use [GET /_cat/cluster_manager] instead.' | ||
|
|
||
| - match: | ||
| $body: | | ||
| /^ | ||
| ( \S+ \s+ # node id | ||
| [-\w.]+ \s+ # host name | ||
| (\d{1,3}\.){3}\d{1,3} \s+ # ip address | ||
| [-\w.]+ # node name | ||
| \n | ||
| ) | ||
| $/ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -50,18 +50,19 @@ | |
| public class RestMasterAction extends AbstractCatAction { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Such class name won't be considered as inclusive?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @owaiskazi19, thanks for your review! The
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds good. Thanks for clearing it.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are welcome! 😁 |
||
|
|
||
| @Override | ||
| public List<Route> routes() { | ||
| return singletonList(new Route(GET, "/_cat/master")); | ||
| public List<ReplacedRoute> replacedRoutes() { | ||
| // The deprecated path will be removed in a future major version. | ||
| return singletonList(new ReplacedRoute(GET, "/_cat/cluster_manager", "/_cat/master")); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the plan to support this old API forever?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The "_cat/master" API will be removed in a future major version. Although the current plan is to remove in version 3.0, it depends on the users' acceptance.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for your idea, I added a comment to indicate the deprecated API will be removed in the future. |
||
| } | ||
|
|
||
| @Override | ||
| public String getName() { | ||
| return "cat_master_action"; | ||
| return "cat_cluster_manager_action"; | ||
| } | ||
|
|
||
| @Override | ||
| protected void documentation(StringBuilder sb) { | ||
| sb.append("/_cat/master\n"); | ||
| sb.append("/_cat/cluster_manager\n"); | ||
| } | ||
|
|
||
| @Override | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.