Skip to content
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

Replace parameter 'master_timeout' with 'cluster_manager_tiemout' in RequestConverters of High-Level-Rest-Client #2683

Merged

Conversation

tlfeng
Copy link
Collaborator

@tlfeng tlfeng commented Mar 31, 2022

Description

This PR can only be merged after all the other PRs listed in the description of issue #2511 (except #2744) are merged.
[^ Prerequisite achieved]

In server directory, the REST API parameter master_timeout is deprecated in version 3.0 (and will be removed in 4.0) to support inclusive naming, and alternative parameter cluster_manager_timeout is introduced (in version 2.0, in issue #2511).
Correspondingly, the new parameter should be used in the High-Level-Rest-Client, which will be done by this PR.

Please note the change will break the compatibility for High-Level-Rest-Client version 3.0 with server 1.x (and below), which means High-Level-Rest-Client version 3.0 will only support server 2.x and 3.x (4.x not exist yet).

  • Use parameter cluster_manager_timeout instead of master_timeout in High-Level-Rest-Client RequestConverters class for building REST requests (Otherwise :client:rest-high-level:asyncIntegTest tests will be broken caused by using master_timeout generating deprecation warning) (in commit 2dfb976)
  • Modify corresponding unit tests
  • Change lots of "master timeout" in internal method and class names. (in commit a2bcb0c)

Issues Resolved

A part of issue #2511

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed per the DCO using --signoff

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.

@tlfeng tlfeng added enhancement Enhancement or improvement to existing feature or request v2.0.0 Version 2.0.0 backport 2.x Backport to 2.x branch backport 2.0 Backport to 2.0 branch blocked Identifies issues that are blocked labels Mar 31, 2022
Signed-off-by: Tianli Feng <ftianli@amazon.com>
@tlfeng tlfeng force-pushed the rhlc-cluster-manager-timeout-simple branch from d15b979 to 2dfb976 Compare March 31, 2022 05:49
@tlfeng tlfeng changed the title Replace parameter 'master_timeout' with 'cluster_manager_tiemout' in RequestConverters of Rest-High-Level-Client Replace parameter 'master_timeout' with 'cluster_manager_tiemout' in RequestConverters of High-Level-Rest-Client Mar 31, 2022
@opensearch-ci-bot
Copy link
Collaborator

❌   Gradle Check failure d15b979dd227f527d665ef823145908ec479eaae
Log 3967

Reports 3967

@opensearch-ci-bot
Copy link
Collaborator

❌   Gradle Check failure 2dfb976
Log 3968

Reports 3968

Signed-off-by: Tianli Feng <ftianli@amazon.com>
@tlfeng tlfeng marked this pull request as ready for review April 13, 2022 18:31
@tlfeng tlfeng requested a review from a team as a code owner April 13, 2022 18:31
@tlfeng tlfeng removed the blocked Identifies issues that are blocked label Apr 13, 2022
@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Check success cda5e04
Log 4447

Reports 4447

…out(TimeValue) in RequestConverters

Signed-off-by: Tianli Feng <ftianli@amazon.com>
@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Check success 0962c11
Log 4454

Reports 4454

Signed-off-by: Tianli Feng <ftianli@amazon.com>
Params withMasterTimeout(TimeValue masterTimeout) {
return putParam("master_timeout", masterTimeout);
}

Params withClusterManagerTimeout(TimeValue clusterManagerTimeout) {
return putParam("cluster_manager_timeout", clusterManagerTimeout);
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: this is the core change for this PR, using parameter "cluster_manager_timeout" instead of "master_timeout" to build REST requests can avoid the deprecation warning.

@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Check success a2bcb0c
Log 4455

Reports 4455

@kotwanikunal
Copy link
Member

kotwanikunal commented Apr 14, 2022

Looking at the files, it looks like a direct replacement of the terms, even in the case of tests even though the parameter is just deprecated. Should we add in duplicate tests around the deprecated term to ensure that the change is non breaking? We can test for the warning instead.

@tlfeng
Copy link
Collaborator Author

tlfeng commented Apr 14, 2022

Looking at the files, it looks like a direct replacement of the terms, even in the case of tests even though the parameter is just deprecated. Should we add in duplicate tests around the deprecated term to ensure that the change is non breaking?

Hi @kotwanikunal Thanks for reviewing!
Hmm, actually it's not necessary to deprecate the old method Params withMasterTimeout(TimeValue masterTimeout) 😂, because the whole RequestConverter class is an internal class (which isn't exposed to the public, seeing from the class access modifier)
So I don't think adding test for the deprecated "master_timeout" parameter in the REST Client is necessary, because nobody from outside can directly call the method. Do you think it's better for me to remove the old method Params withMasterTimeout(TimeValue masterTimeout) instead of deprecation?

@tlfeng
Copy link
Collaborator Author

tlfeng commented Apr 14, 2022

@kotwanikunal Thanks for the reminding. I didn't realize that this will be a breaking change for the High Level Rest Client, which makes it can not communicate with OpenSearch 1.x.

The problem is:
Currently the High Level Rest Client will add the optional parameter master_timeout for every 60 API that accepts this parameter when building the REST API requests.
Keep using master_timeout will cause client test failures due to a deprecation warning in HTTP response header.
Change to use cluster_manager_timeout will break the compatibility for the client with server version 1.x .

There are 3 options to deal with the parameter in High Level Rest Client:

  1. Break the compatibility with OpenSearch 1.x sever to build REST API requests with new parameter cluster_manager_timeout in High-Level-Rest-Client version 2.x. (In the meantime, I think 2.x server has broken the compatibility with 1.x client due to the mapping type removal)
  2. Use deprecated parameter master_timeout to build REST API requests, make 2.x client keep the compatibility with 1.x server. This will result a deprecation warning in the response header for the 60 APIs.
  3. Create an additional method for each of the 60 APIs to allow build REST API requests with either old or new parameter. This seems requires lots of code change. It will make 2.x client keep the compatibility with 1.x server.

In the documentation, it's said 1.x client works with 1.x server, so it's reasonable for the 2.x client to only support 2.x server.
What do you think?

@tlfeng tlfeng added the >breaking Identifies a breaking change. label Apr 14, 2022
@tlfeng
Copy link
Collaborator Author

tlfeng commented Apr 14, 2022

A follow up, I will find out the exact impact to users about the deprecation warning in the response header. If the impact is subtle, I will keep using "master_timeout" in the RestClient to build requests and add "expectWarnings()" into tests.

@tlfeng
Copy link
Collaborator Author

tlfeng commented Apr 15, 2022

Replaced by PR #2912 to keep the backwards compatibility of Rest Client 2.x with server 1.x .

@tlfeng tlfeng closed this Apr 15, 2022
@tlfeng tlfeng added v3.0.0 Issues and PRs related to version 3.0.0 and removed v2.0.0 Version 2.0.0 backport 2.x Backport to 2.x branch backport 2.0 Backport to 2.0 branch labels Apr 15, 2022
@tlfeng
Copy link
Collaborator Author

tlfeng commented Apr 15, 2022

The change can exist in version >= 3.0

@tlfeng tlfeng reopened this Apr 15, 2022
@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Check success a2bcb0c
Log 4527

Reports 4527

@tlfeng tlfeng merged commit 18f4495 into opensearch-project:main Apr 19, 2022
@tlfeng tlfeng deleted the rhlc-cluster-manager-timeout-simple branch April 19, 2022 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>breaking Identifies a breaking change. enhancement Enhancement or improvement to existing feature or request v3.0.0 Issues and PRs related to version 3.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants