The last vada (inventory contention and locking)

The shelf of books a system keeps its facts in. This lesson opens one of them at a single line, the one that says how many vadas are left, and asks what happens when fifty people write on it at once.
Before you start. From The Right Book for the Job (databases, deeply) you need the book itself: the database, where the stall writes its facts down and reads them back, and which can bundle a few reads and writes into one all-or-nothing unit called a transaction. Transactions showed two such units reading the same line and both writing from it, so one write silently erased the other; The Two Ledgers Must Agree (Distributed Transactions) showed a lock left down by a helper who vanished, freezing everyone behind it; and Charged Twice (idempotency & exactly-once) showed that a retried request must carry one name for one intent, so the second try is not a second charge. Each comes back when it is needed.
