Unit 14 · Database research · Lesson 3 of 5
Distributed transactions and recovery research
Step 1: Learn the ideas
- Atomic commit: 2PC, presumed abort, three-phase commit and why it is rarely used
- Two-phase commit over consensus-replicated groups (Paxos Commit)
- Spanner: TrueTime, commit wait, lock-free read-only transactions
- Timestamp alternatives: timestamp oracles and hybrid logical clocks (awareness)
- Calvin and deterministic databases
- Evaluating distributed concurrency control
- Recovery research: fsync failures, crash consistency, recovery time
- Guarantees versus measured performance in this literature
Why it matters
Every globally distributed SQL database has to answer the same questions: how transactions on different partitions commit atomically, how their order is decided, and what happens when a machine or data center fails mid-protocol. The answers involve clocks, consensus and determinism, and the papers mix proofs with deployment measurements. Separating the two is the skill this topic trains.
Core ideas
2PC and its blocking window. A participant that votes yes must keep its locks and wait for the coordinator's decision; if the coordinator fails, participants cannot safely decide alone. Three-phase commit avoids blocking only under timing assumptions that real networks violate, so practical systems make the coordinator and every participant a consensus-replicated group: the vote and the decision are logged in replicated state machines and survive minority failures. Gray and Lamport's "Consensus on Transaction Commit" frames this as running consensus on each participant's vote (Paxos Commit) and compares its message delays with 2PC.
Spanner. Data is split into Paxos groups. Read-write transactions take locks at group leaders (wound-wait prevents deadlock), buffer writes at the client and commit with 2PC across groups. TrueTime returns an interval assumed to contain the absolute time. The coordinator picks a commit timestamp no smaller than the interval's latest bound at the time it receives the commit request, then waits until that timestamp is certainly in the past before making the commit visible (commit wait). Hence, if one transaction commits before another starts, it receives the smaller timestamp: external consistency. Read-only transactions read at a chosen timestamp without locks, on any replica that is sufficiently up to date. The guarantee is conditional: if the uncertainty bound is violated, the ordering argument fails. The costs are commit wait, which grows with clock uncertainty, plus Paxos and wide-area 2PC latency.
Calvin. Calvin moves agreement before execution. A sequencing layer collects transaction requests into batches and replicates this input log; every replica then executes the transactions in the logged order with a deterministic locking scheduler. Because execution is deterministic and a node failure cannot cause an abort, partitions need no 2PC to agree on outcomes. The price is that a transaction's read and write sets must be known in advance, or discovered by a preliminary reconnaissance read, and that the schedule couples nodes, so a slow node can delay transactions that depend on it.
Evaluating designs. Harding et al. implemented six distributed concurrency-control protocols, including a deterministic one, in a single framework on cloud machines. They found that none scaled well across servers, that the best protocol depended on contention and update rate, and that the deterministic protocol suffered when transactions needed lookups to determine their access sets. As with single-node studies, conclusions depend on workload parameters such as the share of multi-partition transactions and on the platform.
Recovery and durability research. All of these protocols assume a log record is durable once flushed. Studies of crash consistency show that applications rely on ordering and atomicity properties file systems do not guarantee, and the fsync-failure study by Rebello et al. shows file systems and applications, databases included, mishandling fsync errors, leading to data loss or corruption. Recovery time research matters too, because availability depends on how quickly a failed node replays its log.
Common misconceptions
- "Spanner proves clocks can be trusted." It shows how to use a clock with explicit uncertainty; correctness rests on the bound holding, an engineering assumption supported by measurements.
- "Calvin eliminates coordination." It moves coordination into the sequencing layer and requires known access sets.
- "Replicating participants makes 2PC non-blocking for free." It replaces waiting for one machine with consensus rounds and still stalls if a group loses its majority.
- "External consistency is the same as serializability." It is strict serializability: serializable and respecting real-time order between non-overlapping transactions.
- "Durable means fsync returned success." Storage-stack behavior on errors and reordering can break that assumption.
How to approach it
Draw message diagrams for plain 2PC, 2PC over Raft groups, a Spanner read-write transaction with commit wait, and a Calvin batch. For each, count wide-area round trips and mark where a failure blocks progress. Read Spanner with its guide on the paper route, then Calvin and the Harding et al. evaluation, recording which statements are guarantees and which are measurements. For research interviews, prepare a short comparison of the three designs and one experiment you would run to test a claim.
Suggested order
- 1Review CMU 15-445 Fall 2025 Lecture #24 notes (Distributed Database Systems II) for atomic commit protocols.
- 2Read Consensus on Transaction Commit (Gray and Lamport), at least the parts comparing two-phase commit with Paxos Commit.
- 3Read the Spanner paper with its paper guide (scheduled on the database paper route); reconstruct the commit-wait proof yourself.
- 4Read the Google Cloud page on TrueTime and external consistency as a plain-language check of your understanding.
- 5Read Calvin, focusing on the sequencer, the deterministic scheduler and the handling of transactions with unknown access sets.
- 6Read Harding et al., An Evaluation of Distributed Concurrency Control, and list the workload parameters behind each finding.
- 7Read the fsync-failure paper’s introduction and findings, and connect them to the durability assumptions of the protocols above.
Step 2: Check off what you can do
Tap each one you can genuinely do or explain. Each earns 10 XP.
Step 3: Go deeper
Spanner: Google's Globally-Distributed DatabaseStart here
Google ResearchThe reference design for externally consistent distributed transactions; separate the TrueTime-conditional guarantee from the measured results.
Open(opens in a new tab)Link responded, 5 Oct 2026Calvin: Fast Distributed Transactions for Partitioned Database SystemsStart here
Yale University (author-hosted PDF)Deterministic transaction processing as the main contrast to clock-based and 2PC-based designs.
Open(opens in a new tab)Link responded, 5 Oct 2026Consensus on Transaction Commit
arXivWhy two-phase commit blocks and how running consensus on each vote removes the single point of failure.
Open(opens in a new tab)Link responded, 5 Oct 2026An Evaluation of Distributed Concurrency Control
PVLDB (VLDB Endowment)A common-framework comparison of distributed concurrency-control protocols, including a deterministic one.
Open(opens in a new tab)Link responded, 5 Oct 2026Can Applications Recover from fsync Failures?
USENIXEvidence that durability assumptions can fail underneath logging protocols.
Open(opens in a new tab)Link responded, 5 Oct 2026
Step 4: Practice
Do the PREPARE TRANSACTION exercise and write down exactly which locks the prepared transaction holds and who is allowed to resolve it. For implementation depth, the MIT 6.5840 Raft and sharded key/value labs give hands-on experience with the replicated groups that production 2PC runs on. Finish with a written comparison: for a transfer between two accounts in different regions, count the wide-area round trips under 2PC over Raft, Spanner and Calvin.
- Observe two-phase commit blocking with PREPARE TRANSACTIONOpen(opens in a new tab)Not attemptedPostgreSQL documentation + local PostgreSQL
- MIT 6.5840 labs: key/value server, Raft, fault-tolerant and sharded key/valueOpen(opens in a new tab)Not attemptedMIT 6.5840
Record attempts on each problem’s page (+15 XP, +10 more when solved on your own).
Step 5: Test yourself
Answer each one out loud or on paper before you finish the lesson.
- Question 1What exactly blocks in 2PC, and what does Paxos Commit change?
- Question 2Why does commit wait need to last until the commit timestamp has certainly passed?
- Question 3How can Spanner serve a read-only transaction without locks, and what is safe time?
- Question 4Which transactions are hard for Calvin, and why?
- Question 5Why might a deterministic protocol win under high contention but lose with dependent lookups?
- Question 6What would you measure to test whether clock uncertainty limits a Spanner-like system’s throughput?
You’re done when you can
- Draw and explain message diagrams for 2PC over consensus groups, a Spanner read-write transaction and a Calvin batch.
- Reconstruct Spanner’s external-consistency argument from the start and commit-wait rules without notes.
- List the guarantees and the measurements in the Spanner and Calvin papers in two columns each.
- Explain one way storage-level durability failures could violate a distributed commit protocol’s assumptions.


