Fixing a MongoDB Replication Protocol Bug with TLA+
summary
The MongoDB replication protocol has a safety bug from 2016 that lets nodes mark entries committed incorrectly and a sequence of liveness bugs in 2018–2019 that prevent commit advancement or create sync‑source cycles that stall replication. A compact TLA+ specification (about 295 lines of TLA+ in one variant, 378 in another) and the TLC model checker expose counterexamples in seconds to minutes — one reproducing the 2016 case explores ~50,000 states in under a minute — and the final solution merges multiple fixes and is backported to correct a 5‑node safety hole.
AI-written summary · about
chapters (12)
- 0:00Intro
- 0:31Talk Outline
- 7:05Background Replication in MongoDB
- 8:13Bug Timeline
- 8:52Heartbeat Commit Point Propagation
- 11:14No Available Sync Source
- 12:47Sync Source Cycle
- 14:33Commit Point Held Back on Stale Nodes
- 15:56Initial Solution Fails in 5 Node Replica Set
- 17:37MongoDB Replication TLA+ Spec
- 19:37Model Checking
- 30:40Takeaways
