Semicolony ELI5 · comic

Write-ahead log (WAL).

Jot the move in a notebook before you make it, so a crash can’t lose it.

  1. Note it first.
    log
    1

    About to make a change. First, write down exactly what you intend to do.

  2. log data
    2

    Only once the note is safely on disk do you touch the real data.

  3. power out!
    3

    Crash! Power cuts out partway through.

  4. Replaying…
    log
    4

    On restart, replay the log — every recorded change is reapplied. Nothing lost.

  5. always append to the end
    5

    The log is append-only, so writes are fast sequential ones, not scattered.

  6. checkpoint, then trim
    6

    It keeps growing, so the system checkpoints and trims it now and then.

Record the intent first; survive a crash by replaying the log.
Semicolony semicolony.dev/eli5/write-ahead-log/comic
← All ELI5 explainers