[BULK] - Re: [Catalyst] flash with DBIC session storage

Jonathan T. Rockway jon at jrock.us
Sat Jul 28 01:26:33 GMT 2007


On Fri, Jul 27, 2007 at 11:57:01AM -0700, Mesdaq, Ali wrote:
> Are you sure that InnoDB would solve this issue? Even if just a row was
> locked and you have 2 inserts at the exact same time how would that
> resolve the issue?

One transaction would succeed and the other would fail.  If you want
different behavior, you'll have to change the isolation level (or
actualy, in this case, rethink your app).

It's more of an issue of this:

User visits page A.
User visits page B in another tab.
User submits form A.
User submits form B.
A updates the flash.
B updates the flash.
Page A2 loads with whatever flash won.
Page B2 loads with whatever flash won.

The point is that both transaction A and transaction B can't go
through.  Web apps aren't designed to be hit concurrently by the same
user; it just doesn't make sense (or work) when you're keeping state.
One state has to win; this is what the DB error is telling you.

You could setup locks over [submit, update flash, display flash]:

User submits form A.
Form A gets the lock.
User submits form B.
B submission blocks waiting for the lock.
A updates the flash.
Page A2 loads.
A unlocks.
B gets the lock.
B updates the flash.
...

This adds a lot of complexity, though.  Is this really a problem that
your users experience, or is it an artifact of poor load testing
practices?

Regards,
Jonathan Rockway



More information about the Catalyst mailing list