Expand description
Memory-mapped WAL segment reader for Event Plane catchup.
Unlike the standard WalReader (which uses sequential read_exact),
this reader maps sealed WAL segments into the process address space via
mmap. The kernel manages the page cache — no slab allocator memory is
pinned, and mmap reads from page cache don’t contend with the Data Plane’s
O_DIRECT WAL append path (O_DIRECT bypasses page cache entirely).
Tier progression:
- In-memory Arc slabs (hot, zero-copy from ring buffer)
- Mmap WAL segment reads (warm, kernel-managed pages)
- Shed consumer + cold WAL replay (last resort)
This reader is used in tier 2: when the Event Plane enters WAL Catchup Mode, it mmap’s the relevant sealed segments and iterates records.
Modules§
- observability
- Module-scoped atomic counters for observing mmap and fadvise behaviour in production. These counters are incremented by the live code paths (open, madvise, fadvise) and may be read from tests or from a metrics scrape.
Structs§
- Mmap
Record Iter - Iterator over records in a mmap’d WAL segment.
- Mmap
WalReader - Memory-mapped WAL segment reader.
Functions§
- replay_
segments_ mmap - Replay WAL segments from a directory using mmap, starting from
from_lsn. - replay_
segments_ mmap_ limit - Paginated mmap replay: reads at most
max_recordsfromfrom_lsn.