Commit Protocols: A Literature Tour

Reading time:2673 words, 14 min read
Last edited:
Commit Protocols: A Literature Tour

Part 2 of a series on commit, written while building CambiumDB. Part 1: What Is a Commit, Really?

In part 1 I built up a claim from scratch: every commit is one ordered decision record, and any store with a conditional write can hold it. This post is the evidence. I've tried to make it exhaustive: every protocol and database I could find a clear description of, sorted by who holds the decision record. They differ in who the authority is, how it survives a crash, and how much it costs to reach the record. None of them gets rid of the record.

Each table answers part 1's questions for one family: where the record lives, and what happens when the authority disappears.

Eight families of commit protocol, by where the decision record lives: one node's log, a coordinator's log, a majority of replicas, a coordinator whose log is replicated, a log behind a sequencer, a store with a conditional write, each system the application touches, or nowhere until the writes converge.

One machine: a single node's log

The simplest authority is one process writing to one disk. Most databases you use are this on the inside, and every family below is built out of it.

System The commit record Notes
PostgreSQL A commit record in the write-ahead log, flushed to disk synchronous_commit = off acknowledges before the flush, trading promise 1 for latency
MySQL (InnoDB) The binary log entry Internally a 2PC between the binary log and InnoDB's redo log, with the binary log as coordinator
SQLite Rollback mode: deleting the journal. WAL mode: a frame marked as a commit One writer at a time, enforced by a file lock
Redis MULTI/EXEC runs on one thread, so it's atomic Durability depends on the fsync policy: with everysec, an acknowledged write can be lost in a crash
Hekaton, Silo A log record per transaction (Silo: per epoch) In-memory engines; Silo makes group commit the unit, committing every transaction in an epoch together

Postgres and Redis show that "committed" is a setting, not a fact. Both can acknowledge a write before its record is durable. That's not a commit by part 1's definition, and both say so in their docs.

One coordinator: two-phase commit (2PC)

Jim Gray's 1978 notes start from the generals paradox: over unreliable messengers, "no fixed length protocol exists" for two parties to agree. So two-phase commit doesn't try to make them agree. It makes the coordinator's logged decision the authority (Gray, 1978).

The cost is blocking: "The classic Two-Phase Commit protocol blocks if the coordinator fails." In the fault-free case it takes four message delays and three sequential writes to stable storage before anyone learns the outcome (Gray & Lamport).

System The commit record Notes
2PC The coordinator's log Blocks if the coordinator fails after participants vote
Presumed abort / presumed commit (R*) The coordinator's log, with an agreed meaning for a missing record Fewer forced writes, and participants forget outcomes sooner
Three-phase commit The coordinator's log, plus a pre-commit state Non-blocking only if "the network never fails"; it handles crashed machines, not partitions
X/Open XA (JTA, MSDTC) The transaction manager's log The standard for spanning databases and message queues; a crashed manager leaves "in-doubt" transactions holding locks
PostgreSQL PREPARE TRANSACTION An external coordinator's log Postgres as a participant; a prepared transaction holds its locks until someone resolves it
Sinfonia No coordinator log at all: the outcome follows from the participants' logged votes A crashed coordinator can't block anyone, because its decision was never the record

Presumed abort is part 1's "missing means no" idea, and it carries straight over to object storage, where an absent object is a cheap, unambiguous answer. Sinfonia is the odd one out, and a useful one: it moves the record from the coordinator to the votes themselves.

A majority: consensus

Gray and Lamport's Paxos Commit runs one Paxos instance per participant's vote, replicated across 2F + 1 acceptors, where F is the number of acceptor failures it tolerates. With F = 1 there are three acceptors, any two of which hold the record. That removes the blocking. Their own conclusion is the most useful line in the whole literature: "Two-Phase Commit and Paxos Commit are essentially the same when F = 0." Same number of stable-storage writes, same message delay in the normal case. Consensus buys availability. It doesn't buy a cheaper commit (Gray & Lamport).

Raft makes the commit point concrete: "A log entry is committed once the leader that created the entry has replicated it on a majority of the servers" (Raft). That's the ordered-log picture from part 1, with a majority standing in for the single disk. Almost everything in this table is that sentence with different names.

System The commit record Notes
Paxos / Multi-Paxos A value accepted by a majority of acceptors Multi-Paxos keeps one leader so each slot needs one round trip
Chubby A Paxos log Locks come with sequence numbers, so storage can fence stale holders
Viewstamped Replication The primary's log on a majority, tracked by a commit number Developed alongside Paxos, independently
Zab (ZooKeeper) A leader's proposal acknowledged by a quorum Primary-backup broadcast with strict ordering per leader
Raft (etcd, Consul) An entry on a majority The leader is the authority; the majority is where its record lives
Kafka KRaft A Raft-style metadata log Replaced ZooKeeper as Kafka's metadata authority
Kafka partitions A message held by every in-sync replica (the high watermark) Not a majority: the in-sync set shrinks and grows, tracked by the controller
EPaxos A command plus its dependencies, on a fast quorum Leaderless; the order comes from dependencies instead of one leader's log
Megastore A Paxos log per entity group Cross-group writes fall back to 2PC or queues
Cassandra lightweight transactions A Paxos round per partition Only for IF conditions; ordinary writes have no commit record
BookKeeper (Pulsar) An entry on an ack quorum of bookies Recovery fences the ledger so an old writer can't append
Aurora Redo records on 4 of 6 storage nodes "THE LOG IS THE DATABASE"; commit completes when the durable position passes the transaction
Socrates (Azure SQL Hyperscale) A separate, replicated log service Splits durability (the log) from availability (the pages)
Neon Postgres WAL on a majority of safekeepers Postgres's single-node record, replicated with Paxos

Coordinator on consensus: 2PC over replicated logs

Most distributed SQL databases keep 2PC and fix its blocking the obvious way: the coordinator's record is itself an entry in a replicated log. If the coordinator dies, the record is still on a majority, and anyone can read the decision.

System The commit record Notes
Spanner The coordinator group's Paxos log Adds commit wait on TrueTime so timestamps match real time
CockroachDB A transaction record in a Raft range Parallel Commits writes a STAGING record whose meaning depends on whether all of the transaction's writes replicated, saving a round
YugabyteDB An entry in a transaction status tablet (Raft) Writes are provisional records until the status entry commits
TiDB (TiKV) The primary key's commit, in a Raft region The Percolator model on Raft; async commit and 1PC skip rounds when they can
MongoDB The coordinator shard's decision, written with majority write concern Cross-shard transactions are 2PC over Raft-like replica sets
Kafka transactions A transaction coordinator's state in the replicated __transaction_state topic Commit markers are then written to every partition the transaction touched
DynamoDB transactions A transaction coordinator's ledger, stored in DynamoDB 2PC with timestamp ordering; the coordinators are stateless, the ledger isn't

A sequencer or adjudicator

A different split: one component decides the order or checks for conflicts, and a log only stores what it decided. The decision and the durable record are separate pieces.

System The commit record Notes
FoundationDB The transaction on every log server for its keys A sequencer hands out versions, resolvers check conflicts (optimistically), log servers make it durable
Aurora DSQL A journal entry An adjudicator checks conflicts; "What goes on the Journal isn't requests for transactions, but committed transactions"
Calvin (and Fauna, built on it) An agreed order of inputs Every replica executes the same inputs deterministically, so the order is the decision
SLOG Calvin-style input order, per home region Single-region transactions are ordered locally; multi-region ones pay for global order
H-Store / VoltDB A command log of ordered stored-procedure calls Single-threaded partitions run transactions one at a time, so there is nothing to race

DSQL's split, an adjudicator that decides and a journal that only ever holds decisions, is the cleanest version of the idea I found.

Making the record cheaper

Every family above has the same bottleneck: the record has to reach durable storage. So most of the production literature is about getting there less often, not avoiding it.

  • Group commit is the oldest trick. DeWitt et al.: "The time to write the log becomes the major bottleneck." Put several transactions' commit records on the same log page, and "a single log I/O is incurred to commit all transactions within the group" (DeWitt et al.). Postgres, MySQL, Raft, Calvin (10 ms epochs), Silo (epochs) and Aurora all batch.
  • Skip a round. CockroachDB's Parallel Commits and TiDB's async commit both let a transaction be decided before its record is fully written, as long as anyone who finds it later can work out the outcome.
  • Skip the coordinator. A transaction that touches one shard needs no 2PC at all; TiDB, CockroachDB and Spanner all take that fast path.

Deciding optimistically

If one authority decides, how does it decide? Most systems in this post use optimistic concurrency control: read, do the work locally, then validate at commit time and abort if something changed (Kung & Robinson).

  • Serializable snapshot isolation in Postgres validates by tracking read-write conflicts between concurrent transactions (Ports & Grittner).
  • FoundationDB's resolvers and DSQL's adjudicator are OCC validators sitting in front of the log.
  • Delta Lake calls its commit protocol exactly that. Iceberg retries a failed commit only after re-checking "the conditions under which they can be applied to a new version" (Iceberg spec).
  • TAPIR goes furthest: replicas don't agree on an order at all, and OCC checks at each shard are what make the transaction consistent.

That validation step matters for anything spanning more than one object. A single conditional write can only say "this one object is unchanged." It can't say "A, B and C are all unchanged." The authority, holding the current state in memory, can check all three and then commit them as one log entry.

One conditional write on shared storage

Here the authority is a store that breaks ties itself, one name at a time: two writers try to create or replace the same name, and the store accepts exactly one. That's the second half of part 1's claim, that any store with a conditional write can hold the decision record.

System The commit record Notes
Bigtable A single-row transaction Percolator builds multi-row transactions on it: erasing the primary lock and writing the commit record is the commit point
DynamoDB conditional writes One item written with a condition The building block many systems use as an external lock or commit store
Git A ref updated only if it still points at the expected commit Why git push is rejected when someone pushed first
Delta Lake _delta_log/N.json, created only if absent Before S3 had put-if-absent, Delta needed a separate coordination service and topped out at "several transactions per second"
Iceberg The catalog's pointer to the current metadata file, swapped atomically The catalog (Hive Metastore, Glue, Nessie, a REST catalog) holds the conditional write
Apache Hudi An instant on the table's timeline Multiple writers need an external lock provider (ZooKeeper, DynamoDB, Hive Metastore)
DuckLake A transaction in a SQL catalog database The data lives on object storage, but the authority is just a database
Lance A new numbered manifest per table version Concurrent writers are resolved by a conditional put or an external commit store
SlateDB A WAL file in a numbered create-only slot A writer epoch in the manifest fences old writers
turbopuffer's queue One JSON file replaced by compare-and-swap The whole queue is one object
Litestream A lease built from conditional writes One replica writes at a time
WarpStream A metadata service's ordering of uploaded files Agents write data to object storage; the commit happens in the metadata service

Notice how many of these push the conditional write somewhere other than the bucket: Iceberg's catalog, Hudi's lock provider, DuckLake's database, WarpStream's metadata service. The data lives on object storage, but the record lives wherever a fast conditional write is available.

There's a good reason for that. S3's guarantee is narrow. With If-None-Match, "the first write operation to finish succeeds" and the rest get a 412, one object at a time, with no multi-object atomicity (AWS). It's also slow. Chris Douglas measured single-object compare-and-swap at about 15 per second on S3 and roughly 1 per second on GCS, and concluded conditional writes should be "a coarse, batch-oriented coordination primitive" (Douglas). Retries are ambiguous too: a retried create that gets a 412 may mean you won the first time (Alex R).

So every design that commits on the bucket itself and needs throughput ends up in the same place: one owner batches writes, and commits each batch with one conditional write.

Fencing, not locking

If there's one owner, what happens when a second process thinks it's the owner too?

A lease says when an owner may start acting (Gray & Cheriton). It can't stop an owner that stalled. Martin Kleppmann makes clear why that matters: a lock holder can be "paused for an extended period of time," so "you simply cannot make any assumptions about timing." The fix is a fencing token the storage checks (Kleppmann). Chubby's sequencers and BookKeeper's ledger fencing are exactly that.

Object storage gives you that check for free when every commit is conditional. In SlateDB, a writer with an old epoch is a "zombie writer," fenced off when a newer writer claims the next slot. In turbopuffer's queue, two live brokers are harmless because the deposed one "gets a CAS failure." The lease keeps things moving, and the conditional write keeps them correct.

When no system spans the write: the application commits

Part 1's second problem: one action, two systems, and no database committing for both. The application ends up running a commit protocol of its own.

Pattern The commit record Notes
Sagas Each step's own local commit A failed step runs compensating steps for the earlier ones; there's no single "yes"
Transactional outbox The order and an "event to send," in one database transaction The database is the one authority; delivery to the second system happens after, and is retried
Idempotency keys The key, stored with the result of the first attempt Turns "did my retry charge twice?" into a lookup

The outbox is the cleanest of the three, for the same reason as everything else in this post: it gets back to one authority and one record.

No single record: tentative and convergent systems

The last family is writers that can't reach anyone, or don't want to wait.

Bayou, from 1995, is the one system in this set built for mostly disconnected replicas. One primary per collection commits updates, because "requiring a majority of these laptops to be in communication" is unrealistic. Other replicas apply writes tentatively, then roll them back and redo them once the primary fixes the order. Users see tentative results grayed out until they're committed (Bayou).

System The commit record Notes
Bayou The primary's order Everything else is tentative until the primary has seen it
Git, before you push Nothing yet Local commits are tentative; the push is the commit
Dynamo / Riak None Concurrent writes become siblings tracked by vector clocks; the application merges them
CouchDB None Every replica picks the same winning revision and keeps the losers for the application
Conflict-free replicated data types (CRDTs: Automerge, Yjs) None needed Operations commute, so every order gives the same result

The theory says when you can get away with no record. Kleppmann and Howard prove a peer-to-peer database can tolerate arbitrary bad actors only if every transaction commutes with respect to the application's invariants (BEC). Anything like "this seat is still free" or "this file still has the version I read" doesn't commute, so it needs a single orderer. Conflict-free replicated data types (CRDTs) are what's left when you only allow operations that do.

What this means for CambiumDB

Put together, the literature points one way for a store that keeps an append-only log on object storage with one owner per namespace:

  • One owner per namespace decides. No 2PC or consensus inside a namespace.
  • Commit is a create-only write of the next numbered log segment. A missing segment means not committed.
  • Batch. Buffer while a write is in flight, and acknowledge only after the batch lands.
  • The lease is for liveness; the conditional write is the fence. Resolve an ambiguous 412 by reading back what's there.
  • Validate multi-path preconditions at the owner, and commit them as one log entry.
  • Edge nodes commit tentatively, and the hub orders and validates them, as Bayou did.

That's the design CambiumDB is moving to. The next post is about the bug that pushed me here.