Fix multiple part uploads at once making vector size inconsistent #2681
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 #2288.
Rationale for this change
I'm working on splitgraph/seafowl#99, and I've been seeing sporadic multipart upload failures with error
Missing information for upload part x
. After a brief investigation I think the fix is quite simple, since the underlying problem stems from an incorrect assumption about the size of the completed parts vector. In other words, inpoll_tasks
ofCloudMultiPartUpload
we should get the size of thecompleted_parts
vector (needed for resizing) for each iteration of the while loop, instead of calculating it prior to entering the loop.To demonstrate how this issue arises consider the following example:
completed_parts = []
total_parts = 0
completed_parts
to max(1 + 1, 0), and set the element at index 1 to the incoming part:completed_parts = [None, Some(part_1)]
completed_parts
to max(0 + 1, 0), which actually means we truncate the last element (thus losing it), and then set the element at index 0:completed_parts = [Some(part_0)]
completed_parts
to max(2 + 1, 0), and fill in the last element:completed_parts = [Some(part_0), None, Some(part_2)]
poll_shutdown
and theNone
above leads toMissing information for upload part 1
What changes are included in this PR?
Get the size of the completed parts inside the while loop pooling the individual tasks, since it is changing with each iteration.
Are there any user-facing changes?
No.