-
Notifications
You must be signed in to change notification settings - Fork 893
Add support for etag validation in resumableFileDownload #6042
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
Add support for etag validation in resumableFileDownload #6042
Conversation
Working on adding an integ test. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice - looks good overall.
I think could use an integration test case added in S3TransferManagerDownloadPauseResumeIntegrationTest
.changes/next-release/feature-AmazonS3TransferManager-21d3a50.json
Outdated
Show resolved
Hide resolved
...c/main/java/software/amazon/awssdk/transfer/s3/internal/utils/ResumableRequestConverter.java
Show resolved
Hide resolved
...ger/src/test/java/software/amazon/awssdk/transfer/s3/util/ResumableRequestConverterTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we need to update DefaultFileDownload#doPause
to capture etag?
@@ -62,6 +62,11 @@ public static byte[] toJson(ResumableFileDownload download) { | |||
jsonGenerator, | |||
"s3ObjectLastModified"); | |||
} | |||
if (download.s3ObjectEtag().isPresent()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add unit tests in ResumableFileDownloadSerializerTest?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call. I added coverage for that new Etag field in the existing test. Do I need to add a standalone test just for that, or is this sufficient?
9977303
to
b64302f
Compare
Yes good call. Actually the integ test I wrote caught that. Fixed now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's kick off integ tests to make sure they are passing if we haven't already
|
Motivation and Context
Added support for ETag validation in resumable file downloads. The Transfer Manager now validates both the
lastModified
timestamp and the ETag when resuming a download. This aims to make sure that if the object has changed on S3 (indicated by a different ETag), the download will restart from the beginning rather than attempting to resume, which could lead to corrupted files.Modifications
s3ObjectEtag
field toResumableFileDownload
to store the ETagResumableFileDownloadSerializer
to include the ETag values.ResumableRequestConverter
to compare the stored ETag with the current S3 object's ETag.Testing