Streaming restore.#879
Open
ximon18 wants to merge 3 commits into
Open
Conversation
Instead of loading it all (e.g. 1 GiB for a large snapshot) into memory at once. Also moves code around to make it easier to read and adds doc comments and error types.
It doesn't need to be a clickable link...
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.
Don't load entire large persisted zone snapshot and diff files into memory, instead parse a subset of records at a time.
This PR introduces a
persistence::streammodule containing aStreamingParserbased aroundBufReader, usingBufRead::fill_buf()and anoverflowbuffer (for reconstructing records that cross the boundary of the end of theBufReaderbuffer and the beginning of the next buffer content after consuming the current buffer content).It also moves code around, adds error types and Rust Docs (also for existing restore related code that lacked Rust Docs).
Whether any of this is worth it is questionable: the main benefit is for large zones, but given that multiple gigabytes of memory are required to load and sign large zones, fully reading a wire serialized zone snapshot into memory isn't that large in comparison (e.g. I have a snapshot for
.nlthat is just under 1 GiB in size, while many GiB are needed to load and sign the zone.Cargo.*,crates/,etc/,integration-tests/,src/):actthrough theact-wrapper(as described inTESTING.md)?