Seat double-booking
Ticketing · Zed Digital
- Problem
- Two customers booking the same seat at the same moment could both succeed: a race condition in the booking flow.
- Fix
- Pessimistic row-level locks on seat records for the whole booking transaction, so simultaneous requests for a seat are serialized.
- Result
- The race is gone. One seat, one booking, even when requests arrive together.
- Concurrency
- PostgreSQL
- Spring Boot