fix(s3/transfermanager): use MultipartUploadThreshold for upload decision#3336
Open
fix(s3/transfermanager): use MultipartUploadThreshold for upload decision#3336
Conversation
…sion The MultipartUploadThreshold option was defined but never referenced in the upload decision logic. The single-upload vs multipart-upload decision was solely based on PartSizeBytes, making MultipartUploadThreshold dead code with no effect on behavior. This fix uses min(MultipartUploadThreshold, PartSizeBytes) as the cutoff for the single vs multipart upload decision. This allows users to set a lower threshold to trigger multipart uploads earlier. With default values (PartSizeBytes=8MB, MultipartUploadThreshold=16MB), the effective threshold becomes 8MB, which is identical to the current behavior since the threshold was previously dead code. Fixes aws#3333 Signed-off-by: abhu85 <60182103+abhu85@users.noreply.github.com> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: abhu85 <60182103+abhu85@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Fixes #3333 -
MultipartUploadThresholdwas defined but never used in upload decision logic.Problem
The
MultipartUploadThresholdfield intransfermanager.Optionswas defined and resolved with a default value (16 MiB), but it was never actually referenced in the upload decision logic. The single-upload vs multipart-upload decision was solely determined byPartSizeBytes, makingMultipartUploadThresholddead code with no effect on behavior.Solution
Use
min(MultipartUploadThreshold, PartSizeBytes)as the cutoff for single vs multipart upload decision innextReader(). This ensures:PartSizeBytes=8MB,MultipartUploadThreshold=16MB), the effective threshold becomes 8MB - identical to current behavior since the threshold was previously dead codePartSizeBytessince we can only observe that much data in the first readChanges
api_op_UploadObject.go: ModifiednextReader()to use threshold-based decisionapi_op_UploadObject_test.go: Added 3 new tests for threshold behaviorTest Plan
TestUploadMultipartTriggeredByThreshold- verifies low threshold triggers multipartTestUploadSingleWhenBelowThreshold- verifies files below threshold use single uploadTestUploadThresholdCappedByPartSize- verifies backward compatibility when threshold > partSizeReproduction
Before fix:
After fix:
🤖 Generated with Claude Code