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

[2.x] Remove deprecation warning of using REST API request parameter 'master_timeout' #2920

Merged

Conversation

tlfeng
Copy link
Collaborator

@tlfeng tlfeng commented Apr 15, 2022

Description

The REST API request parameter 'master_timeout' is deprecated in issue #2511.
The PR removes the deprecation warning when assigning value to the parameter 'master_timeout'.

The plan of deprecation parameter "master_timeout" changed to not show deprecation warning of 'master_timeout' parameter in 2.x version, but start to emit warning from version 3.0 .
For the detailed plan, see issue #2928.

Reason:
This is a compromise with the High Level REST Client (https://github.com/opensearch-project/OpenSearch/tree/1.3.1/client/rest-high-level).
In High Level REST Client, parameter 'master_timeout' is added to every applicable REST API call,
see org.opensearch.client.RequestConverters.Params.withMasterTimeout(TimeValue).
To keep the compatibility of Rest Client 2.x with server 1.x, the parameter 'master_timeout' is preserved.
Emitting deprecation warning in log file and HTTP response header in this case will confuse the user, because the deprecated parameter is not actively used by the user.

Issues Resolved

A part of issue #2928 and #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.

@opensearch-ci-bot
Copy link
Collaborator

❌   Gradle Check failure 45f31149c1c2b6b9e60c8631345d8dc6c97de75e
Log 4521

Reports 4521

Tianli Feng added 2 commits April 15, 2022 13:08
…r_timeout'

Signed-off-by: Tianli Feng <ftianli@amazon.com>
…r_timeout' - comment out part

Signed-off-by: Tianli Feng <ftianli@amazon.com>
@tlfeng tlfeng force-pushed the remove-deprecation-warning-master-timeout branch from 45f3114 to fb59fcf Compare April 15, 2022 20:26
@tlfeng tlfeng changed the base branch from main to 2.x April 15, 2022 20:27
@tlfeng tlfeng added v2.1.0 Issues and PRs related to version 2.1.0 and removed backport 2.x Backport to 2.x branch labels Apr 15, 2022
@tlfeng tlfeng changed the title Remove deprecation warning of using REST API request parameter 'master_timeout' [2.x] Remove deprecation warning of using REST API request parameter 'master_timeout' Apr 15, 2022
Signed-off-by: Tianli Feng <ftianli@amazon.com>
@opensearch-ci-bot
Copy link
Collaborator

❌   Gradle Check failure fb59fcf
Log 4523

Reports 4523

…n 2 action classes

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

❌   Gradle Check failure 97d47e5
Log 4524

Reports 4524

@tlfeng tlfeng marked this pull request as ready for review April 15, 2022 20:51
@tlfeng tlfeng requested a review from a team as a code owner April 15, 2022 20:51
@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Check success 4bea0fe
Log 4526

Reports 4526

@@ -203,27 +202,19 @@ protected Set<String> responseParams() {
return Collections.emptySet();
}

protected static final String DUPLICATE_PARAMETER_ERROR_MESSAGE =
"Please only use one of the request parameters [master_timeout, cluster_manager_timeout].";

Copy link
Collaborator Author

@tlfeng tlfeng Apr 15, 2022

Choose a reason for hiding this comment

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

Note: I moved the constant String outside the method to make it directly used in RestIndicesAction and RestAllocationAction classes in below change. In these 2 classes, the method parseDeprecatedMasterTimeoutParameter() can not fit the requirement, so need the error message used outside the BaseRestHandler, directly in the 2 classes.

if (request.hasParam("master_timeout")) {
logger.deprecate(logMsgKeyPrefix + "_master_timeout_parameter", MASTER_TIMEOUT_DEPRECATED_MESSAGE);
if (request.hasParam("cluster_manager_timeout")) {
throw new OpenSearchParseException(DUPLICATE_PARAMETER_ERROR_MESSAGE);
}
Copy link
Collaborator Author

@tlfeng tlfeng Apr 15, 2022

Choose a reason for hiding this comment

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

Note: the method arguments logger and logMsgKeyPrefix are removed since they are not used without deprecation warning.

@tlfeng tlfeng merged commit 8bc5765 into opensearch-project:2.x Apr 15, 2022
@tlfeng tlfeng deleted the remove-deprecation-warning-master-timeout branch April 15, 2022 22:47
opensearch-trigger-bot bot pushed a commit that referenced this pull request Apr 15, 2022
…'master_timeout' (#2920)

The plan of deprecation parameter "master_timeout" changed to not show deprecation warning of 'master_timeout' parameter in 2.x version, but start to emit warning from version 3.0 .
For the detailed plan, see issue #2928.

Signed-off-by: Tianli Feng <ftianli@amazon.com>
(cherry picked from commit 8bc5765)
tlfeng pushed a commit that referenced this pull request Apr 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.0 Backport to 2.0 branch deprecate v2.0.0 Version 2.0.0 v2.1.0 Issues and PRs related to version 2.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants