An online store has one unit left when two customers click Buy at nearly the same moment. A read-then-write implementation can confirm both orders, especially when requests reach separate application servers.
The scenario
Compare transactions, row locks, atomic stock updates, reservations, and distributed coordination. Explain what happens when payment succeeds but inventory confirmation fails, and how you would make the workflow observable and recoverable.
The question
How would your design behave under retries, replicas, slow payment providers, and a database failover? Which invariant must never be violated?
The official solution is not published yet.Think it through with the community first.
Community discussion
0 contributionsBe the first to share your reasoning.