Write-ahead log (WAL).
Jot the move in a notebook before you make it, so a crash can’t lose it.
- Note it first.1
About to make a change. First, write down exactly what you intend to do.
- 2
Only once the note is safely on disk do you touch the real data.
- 3
Crash! Power cuts out partway through.
- Replaying…4
On restart, replay the log — every recorded change is reapplied. Nothing lost.
- 5
The log is append-only, so writes are fast sequential ones, not scattered.
- 6
It keeps growing, so the system checkpoints and trims it now and then.
Semicolony semicolony.dev/eli5/write-ahead-log/comic