Lesson 18 of 19
17. Transactions and Locking

Sources

3 min read+10 XP

Source notes

  • SQL standard isolation levels and anomalies; PostgreSQL behaviour (Read Committed default, Repeatable Read as snapshot isolation preventing phantoms, Serializable via serializable snapshot isolation with serialization failures to retry): PostgreSQL documentation, "Transaction Isolation". MySQL InnoDB default isolation level Repeatable Read: MySQL documentation.
  • Critique of isolation levels and write skew: Hal Berenson et al., "A Critique of ANSI SQL Isolation Levels", SIGMOD 1995.
  • Sagas: Hector Garcia-Molina and Kenneth Salem, "Sagas", SIGMOD 1987.
  • Two-phase commit and XA: X/Open XA specification; standard database textbooks.
  • Distributed locking, lease expiry and fencing tokens: Martin Kleppmann, "How to do distributed locking", 2016.
  • All signing-event numbers are illustrative assumptions; arithmetic computed 2026-10-08.
  • Level 3 and Level 4 code: tested 2026-10-08 (code/ch17_transactions.py, all checks pass; Level 4 uses real sqlite3 constraints).