[Info-vax] OT: Record locking for web transactions

Stephen Hoffman seaohveh at hoffmanlabs.invalid
Tue Feb 18 18:43:14 EST 2014


On 2014-02-18 22:07:04 +0000, JF Mezei said:

> I read a record with intention to edit/update it. ...
> 
> Comments ?

This is a common question and typical of various recent introductory 
computing classes, and more than a few folks have been interested in 
seat reservation systems either as part of a class assignment or as 
part of an actual implementation.  Accordingly, more than a few related 
discussions are posted around the 'net.

<http://www.demarcken.org/carl/papers/ITA-software-travel-complexity/img0.html>
<http://stackoverflow.com/questions/10096250/database-design-for-bus-reservation> 


A good Bing or Google search string to get you to some of the *many* 
existing discussions, and from there more than a few keywords and 
options:

/site:stackoverflow.com airline reservation seat database algorithm/

Read up on REST, too, as getting back a "dirty read" is no big deal for 
a typical seat reservation system.

More often than not, GET 
<http://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-21#section-5.3.1> 
the available sets — which might be stale — that dirty read — and then 
(maybe) POST 
<http://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-21#section-5.3.3> 
or (more likely) PUT 
<http://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-21#section-5.3.4> 
your change when the customer issues the purchase.  If you wanted to be 
a little more fancy, provide the server with a list of seats or the 
class of seats that the purchaser would accept on the purchase.

I probably wouldn't implement any sort of seat pre-reservation here, as 
a: that's messy to implement, b: can end up being used to jam (DoS) the 
database reservation operations 
<http://arstechnica.com/business/2013/07/engineer-cant-get-decent-dinner-reservations-creates-urbanspoon-dominating-bot/> 
and c: really isn't necessary, given the customer would still have to 
accept the "somebody else bought it" status.

There are also tools that solve these sorts of problems already 
available, too.  Sirvoy is apparently one for hotels, and there are 
undoubtedly other similar packages available.





-- 
Pure Personal Opinion | HoffmanLabs LLC




More information about the Info-vax mailing list