fix(store): uniform compose part sizes for Cloudflare R2 - #33
Open
gonewx wants to merge 2 commits into
Open
Conversation
…non-trailing part sizes
R2 rejects CompleteMultipartUpload when non-trailing parts differ in
length ("InvalidPart: All non-trailing parts must have the same
length."), while S3 only requires >= 5 MiB. The 1 GiB COPY_PART produced
a 5 MiB uploaded part followed by an arbitrarily-sized copied part for
the common bundle shape (small header + large pack), so every bundle
build against R2 failed at Complete.
Cut copy parts at MIN_PART so every non-trailing part — uploaded or
copied — is exactly 5 MiB and only the trailing part may differ. S3
accepts uniform parts equally; a 5 GiB compose now needs <= 1024 copy
requests, a 30 GB one ~6k (below the 10k part limit).
WALGIT_TEST_S3_REGION and WALGIT_TEST_S3_FORCE_PATH_STYLE override the hardcoded us-east-1 / path-style defaults, so the contract suite can run against endpoints that only accept virtual-hosted addressing (R2, OSS). Defaults unchanged for rustfs.
|
The R2 constraint is real (every non-trailing part the same size), but making |
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.
Problem
Bundle builds against Cloudflare R2 fail forever with:
(repeats every maintenance pass; the server log shows
receive-pack-side pushes are fine, onlycomposefails atCompleteMultipartUpload).Root cause
R2 requires every non-trailing part of a multipart upload to have the same length (it answers
InvalidPart: All non-trailing parts must have the same length.), whereas S3 only requires non-trailing parts to be >= 5 MiB.composecut copy ranges atCOPY_PART = 1 GiB. For the standard bundle shape — a small bundle header in front of a large pack — the layout is one 5 MiB uploaded part (header + pack prefix) followed by one large copied part (the rest of the pack), so R2 rejects the Complete. The contract test's compose case only exercises a ~1 MiB trailing copy, a layout that happens to be legal, which is why this never showed up before.Fix
Cut copy parts at
MIN_PARTinstead of 1 GiB, so every non-trailing part — uploaded or copied — is exactly 5 MiB and only the trailing part may differ. S3 accepts uniform parts just as well; part counts stay small (a 5 GiB compose needs <= 1024 copy requests, a 30 GB one ~6k, below the 10k part limit).Verification
UploadPart(5 MiB)+UploadPartCopy(41 MB)): before the fix Complete fails withInvalidPart, after it succeeds and the content round-trips (head, tail, total size).auto): all cases pass, includingtest_compose.bundles/list.pbpublished).Second commit is a small test affordance:
s3_contracthardcodes path-style addressing andus-east-1, which makes it impossible to run the suite against R2/OSS; the two env overrides keep rustfs defaults unchanged.