Skip to content

fix(storage): drop persisted prefix on partial buffered upload resume - #7528

Open
akasakariko wants to merge 1 commit into
googleapis:mainfrom
akasakariko:fix-buffered-partial-resume
Open

akasakariko wants to merge 1 commit into
googleapis:mainfrom
akasakariko:fix-buffered-partial-resume

Conversation

@akasakariko

Copy link
Copy Markdown
Contributor

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 #6683

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
@akasakariko
akasakariko requested review from a team as code owners November 25, 2026 05:46
@product-auto-label product-auto-label Bot added the api: storage Issues related to the Cloud Storage API. label Nov 25, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: storage Issues related to the Cloud Storage API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Partial-resume skips the wrong bytes in the buffered uploader

1 participant