Write-ahead log.
also: WAL · write-ahead logging · write ahead log · WALsAn append-only log every change is written and fsynced to before the data files are updated, so a crash can be replayed safely.
the two-minute refresher
- Updating data in place is not atomic: a crash mid-write corrupts it.
- So: append to the WAL, fsync, then apply to data files; checkpoint and truncate later.
- Recovery replays committed entries from the last checkpoint and discards uncommitted ones.
- Sequential appends are fast, and the same log feeds replication and change data capture.