When ten thousand agents want to try something before they mean it, the transaction abstraction stretches in two directions at once.
Lecture 1 — Distributed Transactions: Calvin vs Spanner · Lecture 2 — Copy-on-Write Branching as Product
Two poles, both published in 2012, still defining the trade space.
txns/sec on TPC-C-like workloads, 100 commodity machines — in 2012, while Spanner-style designs paid cross-datacenter round trips per commit.
BEGIN…COMMIT — submit a whole stored procedure.TT.now() returns [earliest, latest].TT.after(s) is true.expected commit-wait stall — about 5–10 ms per commit, paid so non-overlapping transactions need no communication at all.
| Dimension | Calvin (SIGMOD ’12) | Spanner (OSDI ’12) |
|---|---|---|
| Ordering | Pre-agreed global log | TrueTime + 2PL |
| Distributed commit | None — determinism | 2PC over Paxos |
| Interactive txns | No; recon + re-submit | Yes, full BEGIN…COMMIT |
| Consistency | Serializable | Externally consistent |
| Latency tax | ~10 ms epochs + recon | 2ε wait + 2PC rounds |
| Best agent fit | Declared high-throughput writes | Read-mostly global snapshots |
The mechanism from one B-tree page up to a cloud product.
GetPage@LSN materializes any page at any retained point.to create a branch — one metadata record (child, parent, fork LSN), no pages copied, whether the parent holds 1 GB or 10 TB. The parent can’t even tell it has children.
delete_branch.| Strategy | Formula | Total storage | Create time |
|---|---|---|---|
| 50 full copies (pg_dump/restore) | 50 × 64 GB | 3,200 GB | ~40 min each |
| 50 CoW branches @ 1% divergence | 64 + 50 × 0.64 GB | 96 GB | ~50 ms each |
| Break-even divergence | shared wins until ≈ 98% dirty | — | — |
Dirty pages are private — divergent versions can’t be shared, so deltas add linearly.
storage reduction vs full copies. Caveat: at 1% divergence per day, a branch parked three months pins a quarter-year of parent history — branches are a speculation primitive, not an archival one.
UPDATE credential.GetPage@LSN, layer files, branch creation.