Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
state: Stream records for full replay from persistent state
Currently, before we launch the thread to chunk the records for a full replay, we clone all rows out of the source materialization, constructing an in-memory `Vec<Vec<DfValue>>` containing the rows. This is inefficient - and in the case of persistent state, actually unnecessary, since RocksDB allows multiple threads to concurrently read from the same state. This commit tweaks the API of what was previously called `State::cloned_records` (I've renamed it to `State::all_records`, since it now only clones in the case of MemoryState) such that we no longer have to collect the full vector of records for PersistentState. This adds a little bit of complexity since the state itself is behind an RwLock, has benefits both in terms of runtime - on my machine it speeds up a full replay for a `COUNT(*)` from a 10GB table from about 1m 38s to about 1m 19s - and more significantly in terms of maximum memory usage, since we no longer have to keep the full contents of a base table in memory in order to replay from it. Fixes: REA-2972 Change-Id: I76f67e24a37c15fa8fdfbc5fdfbfeefa11c3a0e0 Reviewed-on: https://gerrit.readyset.name/c/readyset/+/5022 Reviewed-by: Luke Osborne <luke@readyset.io> Reviewed-by: Dan Wilbanks <dan@readyset.io> Reviewed-by: Fran Noriega <fran@readyset.io> Tested-by: Buildkite CI
- Loading branch information
1 parent
a2d92e5
commit de3231f
Showing
5 changed files
with
273 additions
and
127 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.