[CDBI] Re: odd swapping database issue on vhost / mason install

"Edward J. Sabol" <sabol-2oVx0MVsMgiP/[email protected]> Tue, 3 Apr 2007 10:46:50 -0400
Newsgroups gmane.comp.lang.perl.modules.class-dbi
Message-ID <[email protected]>
Ed Sabol wrote:
>> You *definitely* need to disable the object index in this scenario,
>> otherwise the index could become cross-contaminated.

Rolf Schaufelberger replied:
> I'm using this setup since years and have many vhosts running in one
> apache/mod_perl setup and with identical CDBI-Source without problems
> (and withut disabling the object index!).

It's surprising you haven't been bit by this. If you have the same table in
two databases and they have any primary keys in common, then the object index
can cause the wrong instance to be returned. Refer to

http://rt.cpan.org/Public/Bug/Display.html?id=6434

One alternative to disabling the object index entirely is to override
_live_object_key() with a version that uniquely identifies each object with
the database it's from, as suggested by Tony in the discussion for that bug.

Later,
Ed