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 lsn txn type item before->after 1 T1 begin 2 T1 write A 0->5 3 T1 commit CRASH winners: T1 losers: - recovered state item value A 5 redo LSNs: 2 undo LSNs: -

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}