-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Add a new REST API endpoint 'GET _cat/cluster_manager' as the replacement of 'GET _cat/master' #2404
Conversation
Signed-off-by: Tianli Feng <ftianli@amazon.com>
Signed-off-by: Tianli Feng <ftianli@amazon.com>
Can one of the admins verify this patch? |
Signed-off-by: Tianli Feng <ftianli@amazon.com>
public List<Route> routes() { | ||
return singletonList(new Route(GET, "/_cat/master")); | ||
public List<ReplacedRoute> replacedRoutes() { | ||
return singletonList(new ReplacedRoute(GET, "/_cat/cluster_manager", "/_cat/master")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the plan to support this old API forever?
Or is there a EOL defined after couple of major version releases?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The 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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The 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.
Signed-off-by: Tianli Feng <ftianli@amazon.com>
Signed-off-by: Tianli Feng <ftianli@amazon.com>
Signed-off-by: Tianli Feng <ftianli@amazon.com>
rest-api-spec/src/main/resources/rest-api-spec/api/cat.cluster_manager.json
Show resolved
Hide resolved
rest-api-spec/src/main/resources/rest-api-spec/api/cat.cluster_manager.json
Outdated
Show resolved
Hide resolved
"type":"boolean", | ||
"description":"Return local information, do not retrieve the state from master node (default: false)" | ||
}, | ||
"master_timeout":{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this parameter name be changed to be inclusive?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The 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. 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The 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 _cat/cluster_manager
API with this in place, they will continue to use the master_timeout
parameter name. Then, when we deprecate the parameter, they will need to make another change to prevent breakage.
I would rather we use inclusive naming from the get-go in net-new APIs and code paths.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The 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.
I realized that a new json file of rest-api-spec may not necessary, because the main code change I made is to give an alternative API path to _cat/master
, but not adding a new API.
I will modify the code not to create a new json file of rest-api-spec, and find out a better way to deal with the API path change.
If that works, I will also modify the PR title and description, because the code change is not actually adding a new REST API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I modified the code to:
- Rename the current JSON rest-api-spec file
cat.master.json
tocat.cluster_manager.json
- Add path
_cat/cluster_manager
and_cat/master
path as the deprecated path - Test both old and new path in one YAML file to test the both REST API path
If I should deprecate the request parameter master_timeout
, I will make the code change after the PR #2435 merged, because that PR will add the method to validate whether the value of master_timeout
and cluster_manager_timeout
is equal, and also set a sample for all the master_timeout
deprecation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 please add an issue so we don't miss out on it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Signed-off-by: Tianli Feng <ftianli@amazon.com>
Signed-off-by: Tianli Feng <ftianli@amazon.com>
In log 3435:
This is caused by Lucene 9 upgrade, and is tracked in issue #2063 (comment) |
Signed-off-by: Tianli Feng <ftianli@amazon.com>
Signed-off-by: Tianli Feng <ftianli@amazon.com>
Signed-off-by: Tianli Feng <ftianli@amazon.com>
Signed-off-by: Tianli Feng <ftianli@amazon.com>
Signed-off-by: Tianli Feng <ftianli@amazon.com>
@@ -50,18 +50,19 @@ | |||
public class RestMasterAction extends AbstractCatAction { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Such class name won't be considered as inclusive?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @owaiskazi19, thanks for your review! The RestMasterAction
class is published to maven as Java API (https://opensearch.org/javadocs/1.2.4/OpenSearch/server/build/docs/javadoc/org/opensearch/rest/action/cat/RestMasterAction.html). I didn't plan to rename them in 2.0 version, in case giving clients or plugins which use such classes too much work in upgrading to support 2.0 version. 😄
There is a discussion in the PR #2453, you could take a look at. Renaming the Java APIs is tracked in issue #1684
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. Thanks for clearing it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are welcome! 😁
Signed-off-by: Tianli Feng <ftianli@amazon.com>
Description
Add a new REST API endpoint
GET _cat/cluster_manager
, as alternative of the existingGET _cat/master
/_cat/cluster_manager
for the REST request handlerRestMasterAction
/_cat/master
RestMasterAction
handler fromcat_master_action
tocat_cluster_manager_action
GET _cat
to only show the new path/_cat/cluster_manager
cat.master.json
tocat.cluster_manager.json
and update the paths.GET _cat/cluster_manager
andGET _cat/master
Current API response of "GET _cat"
Proposed API response of "GET _cat"
Testing
running YAML REST test
Issues Resolved
Part of #1549
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.