Part 2 β ACID Implementation: Internals and Algorithms
maang.io System Design Series
What is this?
In Part 1 we made four promises β atomicity, consistency, isolation, durability β and waved our hands at "the engine keeps them." This part is the engine room. And the single most important idea down here is almost comically simple: write down what you're about to do, before you do it.
Think of a careful accountant who keeps a running journal. Before touching the actual ledger, they jot in the journal: "about to move $100 from page 4 to page 7." If the office burns down mid-entry, the journal β kept in a fireproof box β is enough to redo or undo everything and arrive at a clean ledger. That journal is the write-ahead log (WAL), and it is the foundation under both atomicity and durability.
The one-line idea: durability and atomicity both fall out of one rule β log the change to disk before you apply it β and isolation falls out of two strategies for letting transactions coexist without tripping over each other: locks and MVCC.
Everything in this chapter is an elaboration of those ideas. Let's build them up.
Sign in to continue reading
The rest of this lesson is available with a free account. Signing in with Google or Microsoft is free.
Sign in to read the full lesson