Following a previous post on Postgres recovery(for fun), I decided to do the same for MySQL, this time tracing the commit path as well and pointing to the relevant source locations. Both systems guarantee durability and recovery but they differ in how they implement it. Postgres has a write-ahead log (WAL) and a transaction's changes are flushed to it before the commit is acknowledged to the user. InnoDB, MySQL's default storage engine, calls its write-ahead log the redo log and it gives the same guarantee: a transaction's redo is flushed to disk before the commit is acknowledged. When the binary log is enabled, MySQL does this in a two-phase commit (2PC) fashion. In the first phase(prepare), InnoDB marks the transaction as prepared and its redo is flushed. Next, the transaction is written to the binlog and fsynced.…