← 📝 Distributed Systems

📝 Write-Ahead Logging: How Databases Survive a Crash

Log entries: 0
State:
Drag — rotate · Scroll — zoom

📝 Write-Ahead Logging: How Databases Survive a Crash

This simulation shows how a database writes sequential log records before applying changes to data pages, and how a simulated crash and recovery pass replays the log to restore a consistent state.

🔬 What It Demonstrates

This simulation shows how a database writes sequential log records before applying changes to data pages, and how a simulated crash and recovery pass replays the log to restore a consistent state.

🎮 How to Use

Trigger writes to append log entries, watch checkpoints apply them to the data files, then force a crash at any moment to see the redo/undo recovery process play out.

💡 Did You Know?

PostgreSQL's WAL and MySQL's InnoDB redo log both use this exact pattern, and the same idea powers journaling filesystems like ext4 and NTFS that protect your files from corruption during power loss.