I've been coding for over 20 years now! (WOAH, do I feel old)
I've touched just about every resource imaginable under the Sun (too bad they were bought out by Oracle)
Really interesting concept on this one. Curious why not just go for the simpler approach? You already have a parent table with the list of rooms themselves, correct? Why not create a lock on the room's row on the parent table, do the serialized work on the child table, and then release the lock on the row on the parent table. This is a much simpler and more elegant solution, and pretty much solves all the problems discussed here.
In the original approach, there is no parent table. The only one table, booking, without the corresponding data for the reservation. Thus, we cannot lock for nothing.
For this practical example, the room list might be stored at the MongoDB or any other data storage. After all, the room list is not the core of this system >.^
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Really interesting concept on this one. Curious why not just go for the simpler approach? You already have a parent table with the list of rooms themselves, correct? Why not create a lock on the room's row on the parent table, do the serialized work on the child table, and then release the lock on the row on the parent table. This is a much simpler and more elegant solution, and pretty much solves all the problems discussed here.
In the original approach, there is no parent table. The only one table, booking, without the corresponding data for the reservation. Thus, we cannot lock for nothing.
For this practical example, the room list might be stored at the MongoDB or any other data storage. After all, the room list is not the core of this system >.^