A write-ahead log stores the before and after images recovery will use.

highlighted = computed this step

The log records every change

Write-ahead logging treats the log as the recovery source of truth. A write record carries a before image and an after image before the page change matters. Note: the table shows the ordered log.

write ahead log\text{write ahead log}

Ordered log table

The compiled log contains 3 records and 1 write record. Note: the before and after images are rendered, not typed here.

records=3,writes=1\text{records}=3,\quad \text{writes}=1

a simplified redo/undo recovery over a tiny log; ARIES detail (fuzzy checkpoints, CLRs, media recovery) and real durability/fsync are beyond these traces - no product claims.

Log records changes - CRASH after LSN 3lsntxntypeitembefore->after1T1begin2T1writeA0->53T1commit winners: T1 | losers: -; redo LSNs: 2; undo LSNs: -itemvalueA5

Summary

The log is the durable evidence recovery replays after a crash. Note: this is simplified redo and undo; ARIES detail, fuzzy checkpoints, CLRs, media recovery, and real fsync durability are deferred.

log as evidence\text{log as evidence}