Consistency and Isolation for Python Programmers
Computers are infuriating.
At PyCon 2023 I talked about consistency and isolation in databases, and showed Python implementations of four isolation levels. Here’s the PyCon video and here’s a Talk Python podcast interview with Michael Kennedy (episode page).
The subject goes a bit deeper than I could cover in 30 minutes; here are links for further reading.
First, orient yourself with Kyle “Aphyr” Kingsbury’s map.
Isolation
Basics
Granularity of Locks in a Shared Data Base, Gray et. al. 1975, or the summary in the Morning Paper part 1 and part 2. This is the earliest paper I’ve read about isolation. It’s fundamental.
A Critique of ANSI SQL Isolation Levels, Berenson et. al. 1995, or the Morning Paper summary.
Advanced
Generalized Isolation Level Definitions, Adya et. al. 2000, Morning Paper.
Optional: Seeing is Believing: A Client-Centric Specification of Database Isolation, Crooks et. al. 2017, Morning Paper.
Consistency
Linearizability
Linearizability: A Correctness Condition for Concurrent Objects, Herlihy & Wing 1990.
Linearizability versus Serializability on Peter Bailis’s blog.
Visualizing Linearizability, Michael Whittaker’s blog.
We often implement linearizability in a distributed system with a consensus algorithm such as Paxos or Raft.
Other consistency levels
Morning Paper: Distributed Consistency and Session Anomalies.