At 11:59 AM -0400 6/30/08, Allen Shaw wrote:
tedd wrote:
Oh, and there's a part 2 as well.
http://www.devshed.com/c/a/MySQL/Using-Transactions-In-MySQL-Part-2
Hi Tedd,
If I understand the intro correctly, that article is about standard
mysql transactions, but the problem I'm having won't really be
solved with usual START TRANSACTION / COMMIT transactions. As an
analogy, consider a instant messenger session between two people on
very slow connections. Transactions can make sure that when one
types a message, that message arrives to its recipient intact -- the
sentence is not broken up or mangled. The latency problem, though,
is when these two people are sending consecutive messages to each
other but not receiving responses in real time. It becomes
vaudeville very quickly: (Are you coming? Will you be late? Yes.
Oh, I mean no. Well I meant that other question. Whatever.)
The problem here is that the user's actions are dependent on the
live data, and the live data can be changed by multiple users at
once, with the various users remaining some minutes (or possibly
more) behind the actual live data. It's a problem that we already
have to guard against in a multi-user environment, but the latency
period, and the potential for collisions, is hugely increased.
Looks like I have some coding to do.
Hi Allen:
I think I understand your problem.
You don't want a user being given a confirmation of a room when in
fact the confirmation has not actually been confirmed because of RACE
conditions.
You could have the situation where several users are looking at the
same open room (provided by the most "up-to-date" information) and
believing that they could reserve it. But, in fact the only one who
will be able to reserve the room will be the one who get's there
first -- the classic RACE problem.
While you feel that transactions will not solve the problem you face,
but the problem you face is the same problem that Transactions face.
I think any solution you create, will resemble the method that
transactions use.
Please read part 2 above.
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk
NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com
Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php