MySQL Logs
All DML operations (INSERT/UPDATE/DELETE) are first performed in the Buffer Pool.
Redo Log
- Provides transaction durability. Redo log is flushed first; dirty pages are flushed later.
Physical Storage Characteristics
File structure
- Fixed-size files (e.g., ib_logfile0, ib_logfile1)
- Circular write (ring buffer)
- Physical appends are always to the end of file
Write pattern
| |
Write-Ahead Logging (WAL)
- Update data pages in the Buffer Pool; the page becomes a dirty page.
- Write the physical changes (e.g., “page X, offset Y, write Z”) sequentially to the redo log buffer.
- On COMMIT, behavior depends on innodb_flush_log_at_trx_commit (commonly 1 by default):
| Value | Behavior | Durability |
|---|---|---|
| 1 (default) | 1) write to OS page cache; 2) fsync() immediately | Full durability |
| 0 | Batch write+fsync every 1s | May lose up to 1s of data |
| 2 | Write to OS page cache but delay fsync | Safe unless OS crashes |
- Dirty page flushing is asynchronous; background threads flush Buffer Pool pages to disk.



Throwable has two subclasses: Exception and Error