Learn Labs
Replication & Scaling

Self-test

Check your understanding

Self-test9 questions

—/9
  1. How does Patroni use the leader key in etcd to make sure only one node is primary?

  2. A clean docker stop failed over in 3.2 s, kill -9 in 23 s. Where does the difference come from?

  3. Clients saw 15 s of errors after a 1.4 s leader change. What caused it, and what fixed it?

  4. Killing the primary with replicas 50 ms behind lost between 0 and 56 acknowledged writes under async (seven runs) and 0 under synchronous_mode. Why did the async loss vary so much, and what did synchronous_mode cost?

  5. What does an "in doubt" write mean, and why can no database setting remove them?

  6. Why did 499 of 500 reads on an async replica miss a row written a moment before, but only 0 to 14 of 500 when each read opened a new connection?

  7. With replicas 5 ms away, sync commits took 18.7 ms instead of about 10. Where did the rest come from?

  8. Name two things that break under PgBouncer's transaction pooling, and the safe alternative for each.

  9. Design question

    Your RPO is zero for payments but the rest of the app can lose a second of data. Design the replication settings, including what happens when a sync replica fails.