Case 4
Preventing Double Booking
Use database constraints, compare-and-swap, or dedicated inventory services — never 'check then insert' without locking.
Two users booking the last seat is a race. The fix is atomic decrement: one transaction wins, the other gets a clear 'sold out' error — not two confirmations.
lockingserializableidempotencyholdoutbox