System design

Stage 2 · Lesson 4 of 10

ACID transactions and the write-ahead log

Data storage, partitioning and replication

A groups several changes so they all succeed or all fail together. ACID names four guarantees. : all or nothing.

Consistency: constraints, rules such as "a balance cannot go negative", hold before and after. Isolation: transactions running at the same time do not see each other's half-done work. Durability: once committed, the change survives a crash.

Durability usually comes from a . Before confirming a commit, the database adds the change to the end of a log file and forces it onto disk. It updates the main data files later.

After a crash, it replays the log to recover. The same log also feeds replication (copying data to other machines) and (streaming changes to other systems).

Common trapassuming every store gives you this: many systems only make a single record atomic, so a transfer between two accounts needs a different design.

A question to check yourself, an AI practice session and 2 cheat sheet entries come with the full roadmap. Unlock

Resources for this stage

Start with· follow one of these

Practise

Also worth your time

Mark this stage as not done?