-
Notifications
You must be signed in to change notification settings - Fork 915
Fix a bug that prevents a retry strategy override to get used #5300
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
Conversation
…ryStrategy This is needed to be able to properly configure retry strategies for AWS services using only the SDK libraries.
There we lot of test files so was not able to pin point which test covers functional testing of this bug ? Could you please help with the Java test files which actually test the functionality when retry strategy is overridden. |
CanOverrideRetryStrategy.java (the link might not work but that's the name of the file at the very bottom of the changes) |
public static final SdkClientOption<RetryStrategy> RETRY_STRATEGY = new SdkClientOption<>(RetryStrategy.class); | ||
|
||
/** | ||
* The internal retry strategy set by the customer. This is likely only useful within configuration |
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 usage of the word internal
here is confusing to me. Can we say The retry strategy set by the customer [where/when]
instead?
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 updated the docs, e.g.,
/**
* The retry mode set by the customer using {@link ClientOverrideConfiguration.Builder#retryStrategy(RetryMode)}. This is
* likely only useful within configuration classes, and will be converted into a {@link #RETRY_STRATEGY} for the SDK's
* runtime.
*
* @see ClientOverrideConfiguration#retryMode()
*/
Let me know if you have a better wording that I can use.
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 like this wording, thanks for updating.
...ore/src/main/java/software/amazon/awssdk/core/client/config/ClientOverrideConfiguration.java
Outdated
Show resolved
Hide resolved
codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/ClientClassUtils.java
Show resolved
Hide resolved
...k-core/src/main/java/software/amazon/awssdk/core/client/builder/SdkDefaultClientBuilder.java
Show resolved
Hide resolved
...ore/src/main/java/software/amazon/awssdk/awscore/client/builder/AwsDefaultClientBuilder.java
Outdated
Show resolved
Hide resolved
...ore/src/main/java/software/amazon/awssdk/core/client/config/ClientOverrideConfiguration.java
Outdated
Show resolved
Hide resolved
...ore/src/main/java/software/amazon/awssdk/awscore/client/builder/AwsDefaultClientBuilder.java
Show resolved
Hide resolved
Additional changes suggested by Zoe and Anna-karin not yet reviewe
23fe873
to
1051b53
Compare
|
) * Scenarios that we need to support when using RetryMode * Use SdkClientOption and lazily set the strategies at build time * Update client tests for the new updateRetryStrategyClientConfiguration method * Create a new change entry for the PR * Fix checkstyle and japicmp issues * Add dependency to retries-spi for all services * Change to client builder properly set retry strategy from plugins * Remove added files by mistake * Add missing dependency to retries-spi module * Add test cases for plugins * Move the retries-spi dependencies to services pom.xml * Update javadocs in an attempt to make them more clear * Update the javadocs * Remove a comment that might be confusing * Put back the original link for the deprecated tag * Address PR comments * Address PR comments
Motivation and Context
Fixes a bug that was found that prevents a retry strategy override from being used as it was overwritten once again to configure it for AWS.
The original logic was there to add AWS-specific retry conditions for when the user set the retry strategy using
RetryMode
or using the mutator to tailor the default oneConsumer<RetryStrategy.Builder>
. We eagerly created the retry strategy, but since this package (sdk-core
) does not know about AWS packages was not able to set the correct one, thus we did patch it after the fact, but this logic is not correct as it prevents user defined overrides to take place and will "over-configure" if an already AWS aware retry strategy is given.Modifications
We now resolve the retry strategy lazily, either when using
RetryMode
or the default one to apply the configured configurator. We need to add logic to the client builder classes and to the client to accomplish this in three different scenarios:For that the following method was added to the client builder and to the client to update the configuration after the plugins are run:
This implies that now the clients themselves have a direct dependency on
retries-spi
which was also added for all services updating theirpom.xml
.Testing
Screenshots (if appropriate)
Types of changes
Checklist
mvn install
succeedsscripts/new-change
script and following the instructions. Commit the new file created by the script in.changes/next-release
with your changes.License