next.js
54503d15 - Clarify lazy SST opening in turbo-persistence docs (#100311)

Commit
19 days ago
Clarify lazy SST opening in turbo-persistence docs (#100311) ## What? Fixes how the turbo-persistence README describes opening the database and reading from it. The old text said every SST file is memory mapped up front. ## Why? The old wording overstated how much memory opening a database costs. In the current implementation: - Opening the database loads only the meta files (memory mapped, or read into heap memory in `AccessMode::File`). It parses their AMQFs and filters out obsolete entries. SST and blob files are not opened. - An SST file is opened lazily, the first time a lookup gets past its hash-range and AMQF checks, and is then cached on its meta entry. - `AccessMode::File` never memory maps SST files. It keeps the block offset table on the heap and reads blocks with positioned reads. - In either mode, opening an SST reads and verifies only its index block. Key and value blocks are read when a lookup needs them. ## How? - Updates the **Opening** steps to match the directory-loading code. - Adds a short lifecycle explanation to **Reading**, covering both access modes and what drives memory cost. - Corrects the lookup outline: - adds the hash-range check - says the AMQF lives in the meta file - shows where the SST is opened Documentation only. The wording was checked against `Db::load_directory`, `MetaEntry::sst`, `MetaFile::lookup_entry` and `StaticSortedFile::open`. ## Verification - Stacked on #100310, which removes the README entry from `.prettierignore` and formats all READMEs. `npx prettier@3.6.2 --check turbopack/crates/turbo-persistence/README.md` passes. - `git diff --check` <!-- NEXT_JS_LLM --> <!-- fleet 9072af3c-95f7-4175-a93d-5b232fe92150 --> Co-authored-by: vercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com> Co-authored-by: Niklas Mischkulnig <4586894+mischnic@users.noreply.github.com>
Author
Parents
Loading