-
Notifications
You must be signed in to change notification settings - Fork 171
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 arguments to specify GET and PUT part size independently #949
Add arguments to specify GET and PUT part size independently #949
Conversation
a490fce
to
349e742
Compare
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.
Thanks for working on this, @crrow!
The changes here don't match the direction we want to go. multipart_upload_threshold
actually isn't used by Mountpoint right now, since we do not specify an object size in advance. Effectively, the threshold is never evaluated for Mountpoint's use case.
Allowing a value to be specified at the command-line for uploads is what we want, let me share what I think it should look like.
I think we should introduce two new arguments: --read-part-size <SIZE>
and --write-part-size <SIZE>
. When we create a meta request for GetObject or PutObject, we should then set that part size on the meta request. The meta request is a way for the AWS CRT to present some nice simple S3 request to us, while under the hood the CRT will change that into multiple GetObject requests in parallel or a multi-part upload when writing.
I hadn't realised, but we already have part-size made available on the MetaRequestOptions
struct (see below). That means we don't have to worry about writing Rust-to-C bindings.
mountpoint-s3/mountpoint-s3-crt/src/s3/client.rs
Lines 386 to 392 in ac6c177
/// Set the part size of this request | |
pub fn part_size(&mut self, part_size: u64) -> &mut Self { | |
// SAFETY: we aren't moving out of the struct. | |
let options = unsafe { Pin::get_unchecked_mut(Pin::as_mut(&mut self.0)) }; | |
options.inner.part_size = part_size; | |
self | |
} |
Please do feel free to reach out on this, happy to discuss any questions.
Oh, I kinda understand, we need to set part size for each put/get operation. So what we need to is changing the S3CrtClient, to make it holds these arguments? Or changing the obejct-client trait to make upper caller can change the part-size proactively? And, should we deprecate the original part size now that we're providing per-request control? |
Hey @crrow,
I was chatting with @monthonk, we think the former makes sense where we modify the client to now have separate part sizes for GET and PUT. This can then be read when creating those requests. That's probably the best option to keep things simple.
One thing that would be nice to keep is the original Meanwhile, the inner fields on |
349e742
to
38e143e
Compare
38e143e
to
4366608
Compare
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.
Super close, just one comment.
Since #956 is now merged, can you make the change suggested and then merge from / rebase on main
?
Signed-off-by: Ryan Tan <hahadaxigua@gmail.com>
Signed-off-by: Ryan Tan <hahadaxigua@gmail.com>
…e; use read_part_size when get Signed-off-by: Ryan Tan <hahadaxigua@gmail.com>
Signed-off-by: Ryan Tan <hahadaxigua@gmail.com>
Signed-off-by: Ryan Tan <hahadaxigua@gmail.com>
Signed-off-by: Ryan Tan <hahadaxigua@gmail.com>
945a2c8
to
4a9f783
Compare
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.
LGTM. Thanks for the contribution, @crrow!
I'll merge this to main now.
Description of change
Relevant issues: #762
Does this change impact existing behavior?
No, this flag is optional, for old CLI arguments, multipart-upload-threshold will be set as same part-size.
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).