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

Edward J. Sabol sabol at alderaan.gsfc.nasa.gov
Tue Apr 3 15:46:50 BST 2007


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



More information about the ClassDBI mailing list