[Catalyst] How safe are database transactions?

Yuval Kogman nothingmuch at woobling.org
Thu Jan 4 12:03:40 GMT 2007


On Thu, Jan 04, 2007 at 10:45:49 +0100, Xavier Robin wrote:

> But is it safe?

As everyone else said - use the method DBIC provided for you, it is
more robust since you don't have anything to remember.

However, you still have to be aware of the ACID semantics of your
DB, because they may be on crack.

IIRC postgresql is actually one of the good guys in terms of this.
MySQL before version 5 (or was it 4.1?) was naughty.

The problem is that if two transactions simultaneously try to add
conflicting data (with relationships) there might be a consistency
issue.

In any case, if the DB cannot sanely accomodate this (no DB can
always guarantee that merging the transaction will work) you still
have to be prepared to catch the death triggered by the
transaction's commit. In most cases you can simply try it again, but
be sure to reload any objects which may have been modified by
another transaction, that you have loaded before the BEGIN.

I'm kind of digressing into handwaving here, because this is a gray
area to most users (including me). Consult your database docs for
more authoritative advice.

-- 
  Yuval Kogman <nothingmuch at woobling.org>
http://nothingmuch.woobling.org  0xEBD27418

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.scsys.co.uk/pipermail/catalyst/attachments/20070104/83c14ccb/attachment.pgp


More information about the Catalyst mailing list