Support prefetch & stale time for S3 web identity provider #27455
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.
Description
When
s3.use-web-identity-token-credentials-provideris configured, then the WebIdentityTokenFileCredentialsProvider is used in AWS SDK to communicate with S3. This provider supports specifying the prefetchTime & staleTime (by default it's 5 & 1 minute).Why is this important? Well, because when we presign an S3 URL (e.g. for Trino client to retrieve the data using the spooling protocol), the attached token will be valid only for as long, as is the remaining validity time of the temporary token that was used to sign the URL. For example, if the MaxSessionDuration in AWS IAM role is kept to it's default 1 hour, then what happens is that every hour new temporary credentials need to be fetched. If prefetch time is 5 minutes (and stale time 1 minute), then the worst-case scenario is that every hour the Trino clients might experience the
ExpiredTokenexception when downloading the spooled segments from a signed S3 url later than 1-5 minutes since their creation.This issue is even worse in case some Trino workers finish their job early, upload their segments to S3, sign them, but then the Trino client still needs to wait for all the remaining workers to finish their part, which might take several more minutes. So if the query is executed just before the session is about to expire, then the clients running such heavy queries are almost guaranteed to experience the
ExpiredTokenexception.Release notes
Release notes are required. Please propose a release note for me.