Repository navigation
fix(storage): drop persisted prefix on partial buffered upload resume - #7528
Open
akasakariko wants to merge 1 commit into
Open
akasakariko wants to merge 1 commit into
akasakariko wants to merge 1 commit into
Conversation
When resuming a buffered upload after partial progress inside a buffered `Bytes` chunk of length `n`, `InProgressUpload::handle_partial` called `b.split_off(n - s)` instead of `b.split_off(s)`, keeping the trailing `s` bytes rather than dropping the `s` already-persisted prefix bytes and retaining the remaining `n - s` bytes Update `handle_partial` to call `b.split_off(s)` and extend `handle_partial_partial_with_remainder` with a non-midpoint offset where `s` differs from `n / 2` Fixes googleapis#6683
Contributor
There was a problem hiding this comment.
Code Review
This pull request simplifies the buffer split-off logic in InProgressUpload by using s directly instead of n - s and ignoring the unused variable n. Additionally, it parameterizes the handle_partial_partial_with_remainder test case to run with both 24 and 32 persisted sizes, replacing hardcoded length constants with the parameterized persisted value. I have no feedback to provide as the changes are correct and well-tested.
This branch has not been deployed
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.
When resuming a buffered upload after partial progress inside a buffered
Byteschunk of lengthn,InProgressUpload::handle_partialcalledb.split_off(n - s)instead ofb.split_off(s), keeping the trailingsbytes rather than dropping thesalready-persisted prefix bytes and retaining the remainingn - sbytesUpdate
handle_partialto callb.split_off(s)and extendhandle_partial_partial_with_remainderwith a non-midpoint offset wheresdiffers fromn / 2Fixes #6683