Conversation
The pager turns page numbers into pinned in-memory frames and owns the buffer pool. Frames are carved from a single arena so the pool is one GC object and each page slice is stable for the pool's lifetime. Get/Unpin is the pin contract the cores will use; Allocate/Free is the page lifecycle; Checkpoint flushes dirty frames, persists the freelist to trunk pages, and fsyncs to make the main file a torn-free image. Replacement is CLOCK with a bounded sweep that fails cleanly when every frame is pinned rather than blocking. Dirty victims can be written back mid-flight because a page is never dirtied before its WAL batch is durable, so an early flush only moves committed bytes home. Concurrency is single-mutex for now. The lock-free read path and sharded page table the spec describes are a later optimization that does not change these signatures.
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.
First vertical slice of M1: the pager that sits between the storage cores and the file.
What this adds
pager.Pagerover thevfsseam: page numbers in, pinned in-memory frames out.Get/Unpinpin contract,Allocate/Freepage lifecycle,Checkpoint(lsn)durability boundary.Open.Design notes
Intent(Read/Write) is advisory this milestone; dirtiness is declared atUnpin.Tests
go test -race ./...green. Pager tests cover create/reopen round-trip, eviction round-trip (64 pages through an 8-frame pool), checkpoint durability across a simulated memfs crash, allocate/free reuse with freelist persistence, and clean pool-exhaustion failure.Implementation doc:
notes/Spec/2059/implementation/04-pager.md.