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

Flexible Checksums V2 #3967

Merged
merged 67 commits into from
Jan 14, 2025
Merged

Flexible Checksums V2 #3967

merged 67 commits into from
Jan 14, 2025

Conversation

landonxjames
Copy link
Contributor

Motivation and Context

Flexible checksums V2 will be launching this week

Description

Testing

Checklist

  • For changes to the smithy-rs codegen or runtime crates, I have created a changelog entry Markdown file in the .changelog directory, specifying "client," "server," or both in the applies_to key.
  • For changes to the AWS SDK, generated SDK code, or SDK runtime crates, I have created a changelog entry Markdown file in the .changelog directory, specifying "aws-sdk-rust" in the applies_to key.

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

It sets default values for the ChecksumAlgorithm field (although that
doesn't actually seem to be reflected in the code at the moment)
Value is not yet added to ConfigBag
Still need to implement tests from SEP
Note: it doesn't actually work because sigv4 is benig added as a dev dep
but is required by one of the inlineable interceptors as a runtime dep
so that still needs to be fixed.
Update codegen to point to new checksum config
To traverse the model via a knowledge index
Update PutBucketLifecycleConfiguration test it now checks the Crc32
checksum header instead of Md5
@landonxjames landonxjames marked this pull request as ready for review January 13, 2025 22:43
@landonxjames landonxjames requested review from a team as code owners January 13, 2025 22:43
Copy link

A new generated diff is ready to view.

A new doc preview is ready to view.

Copy link
Contributor

@ysaito1001 ysaito1001 left a comment

Choose a reason for hiding this comment

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

Excellent work, ship it 🚀

// If we have made it this far without a checksum being set we set the default as Crc32
let checksum_algorithm = incorporate_custom_default(state.checksum_algorithm, cfg)
.unwrap_or(ChecksumAlgorithm::Crc32);
// If we have made it this far without a checksum being set we set the default (currently Crc32)
Copy link
Contributor

Choose a reason for hiding this comment

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

Currently implies we could change it in the future, would that be behind a behavior version or do we think we can just change it without any concern in the future?

Copy link
Contributor

Choose a reason for hiding this comment

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

Had the same question in my mind and my interpretation was to use a behavior version in that case. Programmatically, this PR adds [default] to ChecksumAlgorithm but we can switch the default to a different enum variant without breaking since aws-smithy-checksums is an unstable crate.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The default is not specified by the SEP, so changing it is up to us. I don't think it necessarily would need a behavior version since all of this behavior is opaque to end users, the only difference they might notice is a slight performance change with the new default algorithm. Since any default change would be preceded by performance testing to ensure that the new algorithm is equally or more performant than the old one, I don't see it being an issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Counterpoint from a HN comment: I guess sometimes the "more performant" algorithm can also be less performant for customers in more constrained environments. https://news.ycombinator.com/item?id=42691607

I think we are still ok not. putting this behind a behavior version, but worth thinking about.

landonxjames and others added 2 commits January 14, 2025 11:14
…odes (#3964)

<!--- Why is this change required? What problem does it solve? -->
<!--- If it fixes an open issue, please link to the issue here -->
awslabs/aws-sdk-rust#1234

<!--- Describe your changes in detail -->

PR adds a new interceptor registered as part of the default retry plugin
components that ensures a token bucket is _always_ present and available
to the retry strategy. The buckets are partitioned off the retry
partition (which defaults to the service name and is already set by the
default plugin). We use a `static` variable in the runtime for this
which means that token buckets can and will apply to every single client
that uses the same retry partition. The implementation tries to avoid
contention on this new global lock by only consulting it if the retry
partition is overridden after client creation.

For AWS SDK clients I've updated the default retry partition clients are
created with to include the region when set. Now the default partition
for a client will be `{service}-{region}` (e.g. `sts-us-west-2`) rather
than just the service name (e.g. `sts`). This partitioning is a little
more granular and closer to what we want/expect as failures in one
region should not cause throttling to another (and vice versa for
success in one should not increase available quota in another).

I also updated the implementation to follow the SEP a little more
literally/closely as far as structure which fixes some subtle bugs.
State is updated in one place and we ensure that the token bucket is
always consulted (before the token bucket could be skipped in the case
of adaptive retries returning a delay and the adaptive rate limit was
updated in multiple branches).

<!--- Please describe in detail how you tested your changes -->
<!--- Include details of your testing environment, and the tests you ran
to -->
<!--- see how your change affects other areas of the code, etc. -->

<!--- If a checkbox below is not applicable, then please DELETE it
rather than leaving it unchecked -->
- [x ] For changes to the smithy-rs codegen or runtime crates, I have
created a changelog entry Markdown file in the `.changelog` directory,
specifying "client," "server," or both in the `applies_to` key.
- [ x] For changes to the AWS SDK, generated SDK code, or SDK runtime
crates, I have created a changelog entry Markdown file in the
`.changelog` directory, specifying "aws-sdk-rust" in the `applies_to`
key.

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
@landonxjames landonxjames force-pushed the feature/flexible-checksums branch from 1f256f9 to 4b6aa8a Compare January 14, 2025 19:15
Copy link

A new generated diff is ready to view.

A new doc preview is ready to view.

@landonxjames landonxjames added this pull request to the merge queue Jan 14, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to a conflict with the base branch Jan 14, 2025
Copy link

A new generated diff is ready to view.

A new doc preview is ready to view.

@landonxjames landonxjames added this pull request to the merge queue Jan 14, 2025
Merged via the queue into main with commit f7f037d Jan 14, 2025
43 of 44 checks passed
@landonxjames landonxjames deleted the feature/flexible-checksums branch January 14, 2025 21:15
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.

4 participants