Skip to main content

wal_watermarks

Function wal_watermarks 

Source
pub fn wal_watermarks(root: &Path) -> Result<Watermarks>
Expand description

How far the write-ahead log has been absorbed into published blocks, per signal, in the order crate::wal::Signal::index uses.

This is the whole of WAL recovery’s input, and it is three readdirs — the same ones the read path does at boot anyway. No manifest file, so nothing that can disagree with the blocks it describes.

The maximum over the blocks, not the last one published: scan sorts by timestamp, and a block covering an older hour can be published after a newer one when a late export arrives. Taking the last would then walk the watermark backwards and replay data that is already stored.

A signal with no blocks gets 0 — replay everything the log holds for it, which is right, because nothing has absorbed any of it.