Do we need Record Level Locking when we already have Transaction for online ordering? (of concert ti
Posted
by Jian Lin
on Stack Overflow
See other posts from Stack Overflow
or by Jian Lin
Published on 2010-04-25T10:24:53Z
Indexed on
2010/04/25
10:33 UTC
Read the original article
Hit count: 238
For online ordering of concert seat or airline ticket, do we need Record Level Locking or is Transaction good enough?
For concert ticket (say, seat Number 20B), or airline ticket (even with overbooking, the limit is 210, for example), I think the website cannot lock any record or begin transaction when showing the ticket purchase screen.
But after the user clicks "Confirm Purchase", then the server should Begin a Transaction, Purchase Seat Number 20B, and try to Commit.
If another user already bought Seat 20B in a previous transaction, then it is the "Commit" part that the current transaction will fail?
So... we don't need Record Level Locking? Do Transactions always go serialized (one after another), so that's why we can know for sure there is no "race condition"? In what situation is Record Level Locking needed then?
© Stack Overflow or respective owner