Crash Recovery
The process of restoring consistent data after a system failure or power loss.
Imagine a transaction partway through storing changes. The system crashes before all data reaches disk. The engine must now decide: roll back the incomplete transaction and restore old values, or commit what it can? The answer lies in the transaction log (WAL — write-ahead logging). The engine writes each change's "before" and "after" values to the log before modifying the actual tables. On crash, the engine scans the log and either rolls back incomplete transactions or replays completed ones. This logic underpins ACID guarantees. Checkpoints (write the buffer pool to disk atomically) and log archival speed recovery for large databases.