Concurrency
I building an online movie ticketing web site for my project. See the situation below:
[u]Situation</u>
- 2 users wanto book the same seat at the same time.
[u]Problem</u>
-if 2 users try to book the same seat at the same time, confliction will occur.
-when 2 users click the "Book" button to book the seat at the same time, they dont have any ideal taht the seat is already booked by the other user.
-Database concept: first user book the seat by locking the row to update the row in the database. So the second user cant do the transaction until first user release the lock. That is mean the second user still can continue to book the same seat after the first user finish the transaction. Since we know that only one user can book the seat, but the situation here is the second user has overwrite the first user data.
How to solve this problem? * I'm using asp.net and mysql database.
|