Skip to main content

Book Exercise Lanes

This module's exercise system is book-driven. Use these local chunks for targeted volume after you have already learned the concept from the guide.

How To Use This Page

  1. Finish the relevant concept page first.
  2. Solve at least one problem of your own from memory.
  3. Only then open the matching exercise lane.
  4. Keep a mistake log with tags such as misnamed anomaly, wrong PG isolation mapping, 2PC in-doubt recovery wrong, saga compensation missing idempotency, linearizability violation missed, CAP overclaim, PACELC mislabel.

Lane 1: ACID and Recovery

Use this lane when the issue is property separation, WAL mechanics, or recovery reasoning.

Target outcomes:

  • 1 ACID property map: for each of four common DB features, label A, C, I, or D and justify.
  • 3 worked ARIES recovery traces from a mock log (at least one with a checkpoint inside an active transaction).
  • 1 written failure-mode analysis: "given write cache W, fsync policy F, and replication R, what breaks?"

Lane 2: Anomalies and Isolation Levels

Use this lane when you can state what an anomaly is but cannot recognize it mid-schedule.

Target outcomes:

  • 6 interleaved-schedule drawings, one per anomaly, each labeled with the weakest PostgreSQL level that prevents it.
  • 5 write-skew variants beyond on-call doctors (fresh scenarios).
  • 3 PostgreSQL experiment logs (dirty-read, lost-update, write-skew) with fix shown.
  • 1 written engine-to-level mapping: for five real engines, which isolation name maps to what actual semantics.

Lane 3: Concurrency Control Implementations

Use this lane when you want to distinguish 2PL, SI, and SSI implementations or reason about contention.

Target outcomes:

  • 3 2PL schedules drawn with lock acquisition/release annotations, including one deadlock.
  • 3 MVCC version chain diagrams for an update-heavy hot row, including a long reader scenario.
  • 1 rw-antidependency graph for a write-skew pattern, with cycle flagged.
  • 1 written choice memo: for a given workload sketch, recommend 2PL, SI, or SSI and justify.

Lane 4: Distributed Transactions and Sagas

Use this lane when concept pages are clear but you cannot compose a coordinated workflow from scratch.

Target outcomes:

  • 1 2PC state machine drawn by hand for both roles with fsync points marked.
  • 2 2PC failure traces explained at each step with the recovery action.
  • 1 full saga design (forward + compensation tables + runbook) for a non-trivial workflow.
  • 1 side-by-side comparison of "2PC vs saga" for the same workflow.

Lane 5: Consistency Models

Use this lane when anomaly vocabulary is solid but distributed consistency still feels slippery.

Target outcomes:

  • 3 linearizability-by-hand analyses of histories with wall-clock annotations.
  • 1 causal-vs-eventual anomaly description from a real-feeling application.
  • 1 vendor-claim translation: pick one storage product docs page and produce an honest consistency contract.
  • 1 PACELC label sheet for at least eight systems with justifications.

Self-Curated Problem Set

Build a custom set with these minimums:

  • 6 interleaved schedules (one per anomaly) drawn by hand.
  • 3 PostgreSQL reproductions + fixes with terminal transcripts.
  • 2 2PC failure traces with written recovery.
  • 2 saga designs (one with a non-trivial compensation failure mode).
  • 3 linearizability-by-hand analyses on fresh histories.

Completion Checklist

  • Completed at least one lane in full.
  • Logged at least 12 real mistakes and corrections (isolation-level mapping, anomaly misnaming, 2PC state confusion, causal vs linearizable conflation).
  • Reproduced lost update and write skew on a real PostgreSQL instance.
  • Drew 2PC state machine for coordinator and participant from memory.
  • Designed at least one saga end-to-end with compensation and runbook.
  • Analyzed at least three linearizability histories by hand.