What is a write-ahead log?

Definition

A write-ahead log appends operations or state changes in order before acknowledging the write. If a worker fails, another process can replay the durable log to reconstruct the current state.

Separating the log from materialized repository state can reduce synchronous replication. The design still needs ordering, idempotent replay, retention and compaction so recovery remains correct and efficient.

Acronyms and aliases

WAL acronym

Frequently asked questions

Why is a write-ahead log useful for recovery?

A worker can replay the ordered durable records after failure instead of relying on its lost local state.

Why does a write-ahead log need compaction?

Without compaction, replay cost and storage grow indefinitely as every historical change remains in the log.

Videos explaining write-ahead log