Correctly handle AWS token refreshes for Delta #819
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously we were allowing delta-rs to create it own object stores with its own authentication handling. In order to get parity with our existing auth strategy for AWS (which relies on the official aws-config library to get consistency with aws-cli and other AWS tools), we were fetching a token at delta-rs creation time and passing that to the library.
This works for static, long-lived credentials, but fails for dynamically-refreshed credentials like those from IRSA. This PR reworks our use of delta-rs such that we use our own object_store structs, which properly handle credential refreshing.
While debugging this issue, I also discovered that because object_store uses its own HTTP client to make S3 requests (rather than using AWS smithy), there was no token caching being performed, leading to a huge volume of requests to Amazon STS and some additional latency for S3 operations. This PR also introduces our own sophisticated token cache for AWS, with support for lazy and asynchronous token refreshes.