AWS: Enable Adaptive Retries for AWS KMS client#11420
AWS: Enable Adaptive Retries for AWS KMS client#11420amogh-jahagirdar merged 5 commits intoapache:mainfrom
Conversation
|
@nastra @jackye1995 please review it when you have time, thanks! |
jbonofre
left a comment
There was a problem hiding this comment.
It looks good to me. I just left a nit about pointing to the documentation (especially about retry mode accepted values).
| this.kmsRetryMode = RetryMode.valueOf(KMS_RETRY_MODE_DEFAULT); | ||
| } | ||
|
|
||
| public KmsClientProperties(Map<String, String> properties) { |
There was a problem hiding this comment.
nit: I would add the link to AWS configBuilder configuration, especially about retry mode (to know the accepted values for retry mode).
There was a problem hiding this comment.
@jbonofre Thank you for your review! I linked to both RetryMode and ClientOverrideConfiguration.
|
Is this really necessary to make configurable? Why shouldn't we just set |
|
@danielcweeks Thank you for your review.
I am also working on an enhancement to Iceberg S3 doc: #11321, which makes me think users might want to configure AWS service clients with available configurations provided by the client libraries.
Got it, I have no problem with setting Is having too many options a concern to you? I'd like to learn more about your thoughts. Thanks again for your time. |
I feel like the proliferation of options is not a good thing unless there's real value being added. This doesn't seem to be one of those cases. Rather than adding a lot of boilerplate configuration, I would suggest just setting this at |
|
Thanks for your feedback @danielcweeks Please take a look again. If you still have time, I have another PR for you #11321 |
amogh-jahagirdar
left a comment
There was a problem hiding this comment.
Thanks @hsiang-c I agree with @danielcweeks that we need to be cautious when adding new properties, specifically what that means is evaluating if it's a valuable knob that's worth adding. In this case we know that we generally want to retry when throttled and the recommended strategy is adaptive so the produced clients should just do that without exposing things to users.
Overall this PR looks to be a good direction, just had a comment that I don't think the public KmsClientProperties class is needed at the moment.
| import software.amazon.awssdk.core.retry.RetryMode; | ||
| import software.amazon.awssdk.services.kms.KmsClientBuilder; | ||
|
|
||
| public class KmsClientProperties implements Serializable { |
There was a problem hiding this comment.
Do we need this class considering there's no separate properties we're introducing for KMS and the fact that it may make sense to also apply ADAPTIVE_V2 for Glue client as well (not needed in this PR, but down the line we could just use that)? Just don't want to avoid public properties classes until they're really necessary
I think an applyRetryConfigurations in the existing AwsClientProperties also would work well since that class is meant for generalizing across the different AWS clients.
There was a problem hiding this comment.
@amogh-jahagirdar Thank you for your feedback.
Making applyRetryConfigurations as part of AwsClientProperties makes sense to me.
| awsClientProperties.applyRetryConfigurations(builder); | ||
| RetryMode retryPolicy = builder.overrideConfiguration().retryMode().get(); | ||
|
|
||
| assertThat(retryPolicy).as("retry mode was not set").isEqualTo(RetryMode.ADAPTIVE_V2); |
There was a problem hiding this comment.
Nit: Could we clean up this error message to be "Retry mode should be ADAPTIVE_V2"?
There was a problem hiding this comment.
Sorry I missed this one.
accidentally approved, there's some things I think we should cleanup before
amogh-jahagirdar
left a comment
There was a problem hiding this comment.
Thanks @hsiang-c I think this is very close just some java docs that I think should be cleaned up before merging
| /** | ||
| * Set ADAPTIVE_V2 <a | ||
| * href="https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/core/retry/RetryMode.html">RetryMode</a> | ||
| * for an AWS client builder. | ||
| * | ||
| * <p>For more details, see | ||
| * https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/core/client/config/ClientOverrideConfiguration.Builder.html#retryStrategy(software.amazon.awssdk.core.retry.RetryMode) | ||
| */ |
There was a problem hiding this comment.
Could we structure this JavaDoc similar to the the other apply configuration methods? e.g. checkout the java doc in applyClientCredentialConfigurations or applyClientRegionConfiguration
amogh-jahagirdar
left a comment
There was a problem hiding this comment.
Thanks @hsiang-c , this looks great to me now!
|
Thank you @amogh-jahagirdar |
RetryMode.RetryPolicyb/c it is deprecated.