Name the Rule First, Then Pick the Weakest Level That Holds It
Last timeThe One Snapshots Still Allow
The level is not a preference, it is derived from the rule you need to keep. And every level above the default hands you an error you are obliged to retry.
Seven lessons of mechanism, and one decision to make with them. This lesson is
the procedure, and it starts somewhere most teams never start.
Write the rule down first
Nobody can choose an isolation level from a description of what the code does.
The question a level answers is what must still be true after this transaction
runs, whatever else is running at the same time, and that sentence has to exist
before anything else can be decided.
Good versions of the sentence are concrete and testable. At least one doctor is
on call. No seat is sold twice. The sum of the ledger entries equals the stored
balance. Every order has a payment and every payment has an order.
Bad versions are descriptions of behaviour. The booking is created correctly.
The balance is updated. Those cannot be checked against a database state, so
they cannot tell you anything about what two transactions may do to each other.
The exercise worth doing today is to take the three transactions in your system
that would cause the most damage if they went wrong, and write one sentence for
each. Most teams find that at least one of the three has no agreed sentence,
which is a more useful finding than any level.
From the rule to the level
Once the sentence exists, the choice is nearly mechanical.
The lesson stops here
2 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