Implement MultipartStore for ThrottledStore - #5533
Merged
Merged
Conversation
Limit concurrency in BufWriter Tweak WriteMultipart
tustvold
commented
Mar 20, 2024
| /// Create a new [`WriteMultipart`] that will upload in fixed `capacity` sized chunks | ||
| pub fn new_with_capacity(upload: Box<dyn MultipartUpload>, capacity: usize) -> Self { | ||
| /// Create a new [`WriteMultipart`] that will upload in fixed `chunk_size` sized chunks | ||
| pub fn new_with_chunk_size(upload: Box<dyn MultipartUpload>, chunk_size: usize) -> Self { |
Contributor
Author
There was a problem hiding this comment.
I think this naming is a bit more obvious
tustvold
commented
Mar 20, 2024
| pub async fn wait_for_capacity(&mut self, max_concurrency: usize) -> Result<()> { | ||
| while self.tasks.len() > max_concurrency { | ||
| self.tasks.join_next().await.unwrap()??; | ||
| /// Polls for there to be less than `max_concurrency` [`UploadPart`] in progress |
Contributor
Author
There was a problem hiding this comment.
I've changed this to be less than instead of equal as I think it means if you want to limit to x requests you poll for x requests, as opposed to x - 1
tustvold
commented
Mar 20, 2024
| /// streamed using [`ObjectStore::put_multipart`] | ||
| pub struct BufWriter { | ||
| capacity: usize, | ||
| max_concurrency: usize, |
Contributor
Author
There was a problem hiding this comment.
Prior to #5500 this was an implementation detail of the stores, now it is user configurable 🎉
Jefffrey
approved these changes
Mar 29, 2024
Comment on lines
+259
to
+267
| /// Override the maximum number of in-flight requests for this writer | ||
| /// | ||
| /// Defaults to 8 | ||
| pub fn with_max_concurrency(self, max_concurrency: usize) -> Self { | ||
| Self { | ||
| max_concurrency, | ||
| ..self | ||
| } | ||
| } |
Contributor
There was a problem hiding this comment.
What happens if 0 is passed in?
Contributor
Author
There was a problem hiding this comment.
It will apply backpressure if there is any in-flight request
alamb
pushed a commit
to alamb/arrow-rs
that referenced
this pull request
Mar 20, 2025
* Implement MultipartStore for ThrottledStore Limit concurrency in BufWriter Tweak WriteMultipart * Fix MSRV * Format
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.
Which issue does this PR close?
Closes #.
Rationale for this change
Follow up to #5500
What changes are included in this PR?
Are there any user-facing changes?