Skip to main content

Module reader

Module reader 

Source
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:

  1. In-memory Arc slabs (hot, zero-copy from ring buffer)
  2. Mmap WAL segment reads (warm, kernel-managed pages)
  3. 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.

§Encryption

MmapWalReader::open is the replay constructor: it takes the key ring and hands out plaintext. MmapWalReader::open_raw is the opt-in structural constructor for code that only walks record framing.

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§

MmapRecordIter
Iterator over records in a mmap’d WAL segment.
MmapWalReader
Memory-mapped WAL segment reader.