[CDBI] Is standard idiom for transactions really safe?

Perrin Harkins perrin at elem.com
Thu Mar 2 18:47:23 GMT 2006


On Thu, 2006-03-02 at 10:32 -0800, Phil Mitchell wrote:

> Hmm, okay. I'm not trying to be super-paranoid, just wanted to see if
> I was missing something -- I don't have a good feel for how rare these
> events actually are.

In my experience, when you lose the connection to the server in the
middle of a request (as opposed to not being able to get a connection at
the start of one), it typically means something serious has happened,
and you won't be able to reconnect right away.

If you run under mod_perl, it wouldn't be hard to make an Ima::DBI
variation that only reconnects at the start of a request.  You could
just use pnotes to track whether this is the first database handle fetch
during the current request, and throw an exception if it isn't rather
than reconnecting.  You could probably do this by overriding db_Main if
you want to avoid touching Ima::DBI.

- Perrin






More information about the ClassDBI mailing list