Pattern 04 / DATA

Write-Ahead Log (WAL)

Use this when recovering durable writes after a crash without corrupting storage.

Pressure
Recovering durable writes after a crash without corrupting storage
Mechanism
Append the intended change to a sequential log before mutating primary data files; replay the log on restart
Toll
Extra write amplification and log compaction/retention work
Architecture plate04
Diagram for Write-Ahead Log (WAL)
Executive brief

Write-Ahead Log (WAL) fits when recovering durable writes after a crash without corrupting storage. Mechanism: append the intended change to a sequential log before mutating primary data files; replay the log on restart. Use it for databases, replication streams, CDC pipelines, and durable queues. The toll: extra write amplification and log compaction/retention work.

Use when

Databases, replication streams, cdc pipelines, and durable queues.

Example

Postgresql replaying wal after a host restart.

Review framing

Describe the pressure first, then the mechanism, then the cost. That keeps the design grounded.

Same pressure family

Data Storage Patterns

01Primary-Replica (Leader-Follower)02Sharding (Horizontal Partitioning)03Consistent Hashing05Event Sourcing06CQRS (Command Query Responsibility Segregation)
โ† 0305 โ†’