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

Fix native Smithy client retry and retry response errors #1717

Merged
merged 14 commits into from
Sep 14, 2022

Conversation

jdisanti
Copy link
Collaborator

@jdisanti jdisanti commented Sep 7, 2022

Motivation and Context

This PR addresses awslabs/aws-sdk-rust#303 and #1715.

Checklist

  • I have updated CHANGELOG.next.toml if I made changes to the smithy-rs codegen or runtime crates
  • I have updated CHANGELOG.next.toml if I made changes to the AWS SDK, generated SDK code, or SDK runtime crates

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@jdisanti jdisanti requested a review from a team as a code owner September 7, 2022 23:02
@github-actions
Copy link

github-actions bot commented Sep 7, 2022

A new generated diff is ready to view.

A new doc preview is ready to view.

@github-actions
Copy link

github-actions bot commented Sep 7, 2022

A new generated diff is ready to view.

A new doc preview is ready to view.

@jdisanti
Copy link
Collaborator Author

jdisanti commented Sep 8, 2022

Need to decide what to do about the "retry policy" to "response classifier" rename. The "response classifier" name is a lot more accurate, but the rename goes deep since the operation retry_policy and with_retry_policy functions will also need to be renamed, and examples fixed:
https://github.com/awsdocs/aws-doc-sdk-examples/blob/3b8c70b319882a40a03aedfcd5383b6851c9dd76/rust_dev_preview/dynamodb/src/bin/movies.rs#L302-L319

That example also mentions "retry every second until the table is ready" in its comments, but I highly doubt that's what's actually happening. It's probably using exponential backoff.

@rcoh
Copy link
Collaborator

rcoh commented Sep 8, 2022

That example also mentions "retry every second until the table is ready" in its comments, but I highly doubt that's what's actually happening. It's probably using exponential backoff.

It's using RetryKind::Explicit(Duration::from_secs(1)), so that is accurate at least.

I'd recommend doing the rename, adding new methods, deprecating the old ones, and deleting them in a future release to simplify coordination

Copy link
Contributor

@Velfi Velfi left a comment

Choose a reason for hiding this comment

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

😍

@@ -186,3 +186,21 @@ message = "Smithy IDL v2 mixins are now supported"
references = ["smithy-rs#1680"]
meta = { "breaking" = false, "tada" = false, "bug" = false, "target" = "all"}
author = "ogudavid"

[[smithy-rs]]
message = "Generated clients now retry transient errors without replacing the retry policy."
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
message = "Generated clients now retry transient errors without replacing the retry policy."
message = "White-label smithy clients now have a default retry policy and will retry requests returning a transient HTTP error."

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

White label/adhoc AWS clients already had retry. This is specifically fixing for Smithy clients. I think this should be clear by it being a smithy-rs entry.

aws/rust-runtime/aws-http/src/retry.rs Outdated Show resolved Hide resolved
pub struct AwsResponseClassifier;

impl AwsResponseClassifier {
/// Create an `AwsResponseClassifier` with the default set of known error & status codes
Copy link
Contributor

Choose a reason for hiding this comment

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

It'd be cool if we could link to code or docs showing what errors get retried

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If there is a way to link to the private constants with rustdoc, then I could add this pretty easily. I'm reluctant to duplicate the list in the documentation since it will get out of date.

aws/rust-runtime/aws-http/src/retry.rs Outdated Show resolved Hide resolved
@Velfi
Copy link
Contributor

Velfi commented Sep 8, 2022

@jdisanti Will you be submitting an examples update PR as well?

@github-actions
Copy link

github-actions bot commented Sep 9, 2022

A new generated diff is ready to view.

A new doc preview is ready to view.

@jdisanti
Copy link
Collaborator Author

jdisanti commented Sep 9, 2022

@jdisanti Will you be submitting an examples update PR as well?

Yeah.

@github-actions
Copy link

github-actions bot commented Sep 9, 2022

A new generated diff is ready to view.

A new doc preview is ready to view.

@jdisanti
Copy link
Collaborator Author

jdisanti commented Sep 9, 2022

Examples fixed in awsdocs/aws-doc-sdk-examples#3593

@jdisanti jdisanti mentioned this pull request Sep 10, 2022
28 tasks
@github-actions
Copy link

A new generated diff is ready to view.

A new doc preview is ready to view.

@@ -102,7 +103,10 @@ mod tests {
});

let mut svc = ServiceBuilder::new()
.layer(ParseResponseLayer::<TestParseResponse, ()>::new())
.layer(ParseResponseLayer::<
TestParseResponse,
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider calling this "TestResponseHandler" or, instead, changing the verbiage for "response handler" to "response parser"

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think the name is actually fine considering it implements ParseStrictResponse. I think handler might actually be the out of place name that should potentially get fixed in other places.

Co-authored-by: Zelda Hessler <[email protected]>
@github-actions
Copy link

A new generated diff is ready to view.

A new doc preview is ready to view.

@jdisanti jdisanti enabled auto-merge (squash) September 14, 2022 20:02
@github-actions
Copy link

A new generated diff is ready to view.

A new doc preview is ready to view.

@jdisanti jdisanti merged commit e6177b3 into main Sep 14, 2022
@jdisanti jdisanti deleted the jdisanti-retry-response-errors branch September 14, 2022 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants