publish: upload large files in parts, retrying each part - #8
Merged
Merged
Conversation
A single PutObject of a large parquet fails the whole file on one dropped TLS record, and publish with it. Bodies over 16 MiB now go up as a multipart upload, one part at a time, each retried up to four times; a part that keeps failing aborts the upload and reports a retryable error. Conditional writes stay a single PutObject. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
publishsent every file as onePutObject. Adataset_referencedrelease uploads its parquet beside the page, and on a project with about 4M event rows that is five files totalling 263 MiB, the largest 160 MiB. On a connection that drops a TLS record now and then, a single long upload fails as a whole (ssl3_read_bytes: bad record mac), and publish fails with it: in two runs every small file went up and not one parquet did.What changes
putruns a multipart upload: create, then one 16 MiB part at a time, then complete with the parts' ETags in order. One part at a time, because the body is already in memory and parallel parts would only put more of it on a connection that is dropping records. Every part but the last is the same size, which R2 requires.transient_dependency, marked retryable, and names the key.PutObject.latest.jsonis written withIf-Match/If-None-Match, which a multipart upload cannot carry; it is small anyway.makeS3Opstakes an optional client and tuning so the upload path can be tested without the network. No new dependency: the multipart commands come from@aws-sdk/client-s3, already in use.Testing
pnpm test: 386 passed; the 3 live tests skipped.tests/publish/s3multipart.test.ts(5): a small body is onePutObject; a large one splits into ordered parts of the right sizes and completes with their ETags; a failing part is retried without restarting the upload; a part that keeps failing aborts with a retryable error; a conditional write stays onePutObjectwhatever its size.forkfrom the public URL then rebuilt offline to the same 19 query results.🤖 Generated with Claude Code