Add non-zero check for incremental upload buffer sizes#1543
Open
mansi153 wants to merge 2 commits intoawslabs:mainfrom
Open
Add non-zero check for incremental upload buffer sizes#1543mansi153 wants to merge 2 commits intoawslabs:mainfrom
mansi153 wants to merge 2 commits intoawslabs:mainfrom
Conversation
Signed-off-by: Mansi Pandey <[email protected]>
Contributor
|
Could you include the error message that's displayed when this fails in the description? |
passaro
requested changes
Jul 28, 2025
mountpoint-s3-fs/src/upload.rs
Outdated
| initial_offset: u64, | ||
| initial_etag: Option<ETag>, | ||
| ) -> AppendUploadRequest<Client> { | ||
| assert!(self.buffer_size > 0, "write-part-size should be greater than 0 for incremental uploads"); |
Contributor
There was a problem hiding this comment.
This seems the wrong place to check. Why not UploaderConfig::new (where buffer_size is passed)?
Also, the message here should be related to this type, rather than user-facing. --write-part-size is a CLI argument and should be validated elsewhere.
Contributor
There was a problem hiding this comment.
Maybe we should consider making the size (NonZero)[https://doc.rust-lang.org/std/num/type.NonZeroU32.html]?
Signed-off-by: Mansi Pandey <[email protected]>
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.
Add non-zero check for upload buffer-sizes.
This is done so that we avoid runtime exceptions for invalid sized buffers and division by 0 during capacity calculations in current or future incremental uploads. The buffer_size currently is derived from
write-part-size. We have a check for read/write part-sizes being in the range [5MiB, 5GiB] in theCrtClientConfig. However, there are some tests and testing trait-implementations which don't do the same validation and hence need explicit checks in the upload constructor.Does this change impact existing behavior?
No.
Does this change need a changelog entry? Does it require a version change?
No, minor code enhancement entry.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and I agree to the terms of the Developer Certificate of Origin (DCO).