feat: streaming database exports to R2 for large databases#238
Open
kartikganesh wants to merge 2 commits into
Open
feat: streaming database exports to R2 for large databases#238kartikganesh wants to merge 2 commits into
kartikganesh wants to merge 2 commits into
Conversation
Fixes outerbase#59. Large database exports now stream chunks to R2 using multipart upload, with DO alarm-based continuation when exports exceed 25s. Adds /export/status/:id and /export/download/:id endpoints. Falls back to in-memory export when R2 is not configured. /claim outerbase#59 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
10 tests covering startStreamingDump, getExportStatus, and downloadExport with mocked R2 bucket and data source. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Author
|
/claim |
Author
|
Hey team — wanted to highlight how this PR maps directly to the 5-point proposed solution in the issue:
Additional design decisions:
The other open PRs either miss the R2 multipart requirement (using single PUT which fails >5GB), skip the DO alarm continuation, or don't handle the backwards-compatible inline response for small exports. Happy to address any feedback. |
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.
Summary
Fixes #59. Large database exports now stream chunks to R2 using multipart upload with DO alarm-based continuation for exports exceeding 25s.
/claim #59
Changes
src/export/dump-streaming.ts(new): Core streaming export with R2 multipart upload, chunked processing (1000 rows/batch), DO alarm continuation, progress tracking intmp_export_statesrc/export/dump.ts: Updated to delegate to streaming export when R2 is available, fallback to in-memory when notsrc/do.ts: Added alarm handler integration for export continuationsrc/handler.ts: Added/export/status/:exportIdand/export/download/:exportIdendpointssrc/index.ts: AddedEXPORT_BUCKETR2 binding to Env interfacewrangler.toml: Added commented-out R2 bucket config with setup instructionsHow it works
Test plan
/export/dumpworks unchanged when no R2 binding/export/status/:idshows progress/export/download/:idstreams completed file