Repository navigation
fix(export): paginate large database dumps in bounded chunks with breathing intervals and R2 support (#59) - #319
Open
hornsandhalos619 wants to merge 1 commit into
Conversation
…athing intervals and R2 support (outerbase#59)
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 large database export OOMs and Durable Object lockups in
/export/dumpand table exports by paginating table rows in boundedLIMIT ... OFFSET ...batches, encoding chunks directly intoUint8Arraybuffers, yielding cooperative breathing intervals when continuous execution exceeds the active window, and supporting optional R2 bucket offload (dump_YYYYMMDD-HHMMSS.sql) + completion webhook callback.Changes
src/export/index.ts: AddedpaginateTableDataasync generator with boundedbatchSize(default500) and cooperativebreathingIntervalMspauses aftermaxActiveWindowMs.src/export/dump.ts: UpdateddumpDatabaseRouteto paginate large tables in chunks, encode batches toUint8Array, support optionalr2Bucket.put('dump_YYYYMMDD-HHMMSS.sql', ...)andcallbackUrlnotification, and formatNULL/boolean/number/escaped string SQL literals cleanly.src/export/dump.test.ts&src/export/dump.node.test.ts: Added unit tests covering multi-batch pagination, breathing intervals, R2 bucket persistence, and SQL literal formatting.Closes #59
/claim #59