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

TransferManager.upload doesn't retain bucketKeyEnabled setting if using multipart upload #3107

Open
1 task done
ZhaoMJ opened this issue Apr 23, 2024 · 1 comment
Open
1 task done
Labels
bug This issue is a bug. p2 This is a standard priority issue

Comments

@ZhaoMJ
Copy link

ZhaoMJ commented Apr 23, 2024

Upcoming End-of-Support

  • I acknowledge the upcoming end-of-support for AWS SDK for Java v1 was announced, and migration to AWS SDK for Java v2 is recommended.

Describe the bug

If multipart upload is used, files uploaded by the TransferManager don't have the correct object-level bucket key setting as specified in the PutObjectRequest.
It turns out that the bucketKeyEnabled setting is not copied when configuring the InitiateMultipartUploadRequest:

req.withAccessControlList(origReq.getAccessControlList())
.withRequesterPays(origReq.isRequesterPays())
.withStorageClass(origReq.getStorageClass())
.withRedirectLocation(origReq.getRedirectLocation())
.withSSECustomerKey(origReq.getSSECustomerKey())
.withSSEAwsKeyManagementParams(origReq.getSSEAwsKeyManagementParams())
.withGeneralProgressListener(origReq.getGeneralProgressListener())
.withRequestMetricCollector(origReq.getRequestMetricCollector())
;

Expected Behavior

Objects uploaded by the TransferManager always have the correct object-level bucket key setting as specified in the PutObjectRequest.

Current Behavior

Objects uploaded by the TransferManager don't have the correct object-level bucket key setting as specified in the PutObjectRequest when multipart upload is used.

Reproduction Steps

  1. have a bucket with bucket-level bucket key disabled
  2. Create a TransferManager with a MultipartUploadThreshold of 8MB.
  3. Upload a file of 12MB using
            PutObjectRequest putObjectRequest = new PutObjectRequest(bucket, key, src)
                    .withSSEAwsKeyManagementParams(sseAwsKeyManagementParams)
                    .withBucketKeyEnabled(true);
  1. Verify that S3 bucket key is used for this file.
  2. Create another TransferManager with a MultipartUploadThreshold of 16MB.
  3. Upload the same file with the same PutObjectRequest using the new TransferManager.
  4. Verify that S3 bucket key is not enabled for this file.

Possible Solution

Copy bucketKeyEnabled from PutObjectRequest to InitiateMultipartUploadRequest, i.e. Add the following to UploadCallable.initiateMultipartUpload:

req.withBucketKeyEnabled(origReq.getBucketKeyEnabled())

Additional Information/Context

No response

AWS Java SDK version used

1.12.466

JDK version used

openjdk version "17.0.9" 2023-10-17 LTS OpenJDK Runtime Environment Zulu17.46+19-CA (build 17.0.9+8-LTS) OpenJDK 64-Bit Server VM Zulu17.46+19-CA (build 17.0.9+8-LTS, mixed mode, sharing)

Operating System and version

macOS 13.6.3

@ZhaoMJ ZhaoMJ added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Apr 23, 2024
@debora-ito
Copy link
Member

@ZhaoMJ thank you for raising this. Yes, it looks like bucketKeyEnabled is not being passed to InitiateMultipartUploadRequest. Marking as a bug.

The team's focus is in Java SDK v2 work, so this has low chance to be fixed before the start of Maintenance Mode later this year.

@debora-ito debora-ito added p2 This is a standard priority issue and removed needs-triage This issue or PR still needs to be triaged. labels May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. p2 This is a standard priority issue
Projects
None yet
Development

No branches or pull requests

2 participants