Index

Free, with Google

Keep going, free.

A free account opens lessons 2 and 3 of every track, 33 more lessons, and keeps your progress and review cards on every device.

Start free with Google

A chalk plan

Open everything on chalk.

Every lesson, board, video, lab and paper, and the full review decks. Yearly is $39/year.

See plansStart free instead

Module 01 · Database Internals · One Database, to the Bolt · about 17 min to read

Play it as a journeyTutor comes with a plan

Copying the log across: replication internals

WAL & Recovery
WAL & Recovery · Open board

The log that every change reaches before its page does. This lesson sends that same log to a second machine.

Before you start. WAL & Recovery gave you the write-ahead log: every change is written to the log first, and a crash is repaired by replaying it. The engine in production showed a replica that runs a little behind and a slot that holds log on disk, and this lesson opens both up. Replication named the three shapes of copying (leader and followers, sync or async) and this lesson goes inside one database. Backups and the day you need them (RPO, RTO, and the restore nobody tested) shipped log files to storage, and here the same log goes to a live machine.

Lesson 18 of 26 in Database Internals

The rest of this lesson is part of a plan.

A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year.

See plansAlready a member? Sign in

Or start free: a free account opens lessons 2 and 3 of every track.

In this lesson

  • 21 October 2018: a 43-second gap, and a day of repair
  • Physical streaming: the replica receives the log as it is written
  • Logical replication: the replica receives the meaning of each change
  • The replication slot: the primary’s promise to keep log
  • Promotion: a replica becomes the primary, and some writes are lost
  • The old primary: two histories that must not be merged
  • The path of one commit, on a real primary
  • What a physical standby is made of
  • What logical replication is made of
  • Failover, step by step
  • Edge cases

Terms it explains: physical streaming replication, Logical replication, subscriber, replication slot, promote, synchronous, diverged, Common mistakes, WAL shipping, output plugin, publication, subscription, replica identity.

Lab

You checkpoint three times as often for a faster restart. Why does the log get bigger?

Drag How long the log may run between checkpoints to its shortest, press Add next write repeatedly, and watch If the power died now.

Open The write-ahead log

Related papers

Review Database Internals