The Promise Is Weaker Than You Think
Last timeGetting It Right Without Waiting
A transaction promises all or nothing, and that nobody sees your half-finished work. The second promise is a dial, and the default setting is not the strongest one.
A transaction is sold as the thing that makes concurrency somebody else's
problem. It is not, and the gap between what it promises and what people assume
it promises is the source of a specific family of production bugs.
There are two separate guarantees in the box.
All of it or none of it
The first is the one that works exactly as advertised. Every change inside the
transaction takes effect, or none of them does. A crash in the middle leaves no
trace of the half that had been done.
The second guarantee is a dial
The second guarantee concerns what other transactions can see while yours is
running, and it is not a fact about the database. It is a setting, with named
levels, and each level permits a specific list of anomalies.
The lesson stops here
5 more paragraphs to go
You have read the opening. The rest of the argument, the problems that check whether it landed, and the lines worth keeping at the end all come with a plan.
The first lesson of every course in the library reads the whole way through, free, so you can see exactly what the rest of them are.
See the planThe contentsThis is the reading half
Starting the course gives you your own copy of it. Every idea on every page has problems standing under it, marked with a reason rather than a tick, and any sentence you do not believe can be opened and argued with. None of that can happen on a page nobody owns.
The contents