On 7/18/11 9:08 AM, Alexandre Garel wrote: > Hello, > > We are building up an application where we use multiple zodb instances. > Indexation is done using solr. > zodb are served through zc.zodbwsgi. ZODB connections are set only > on-demand, upon traversal. Each zodb has its intid local utility. Each > object also has a uuid. > > I have a zodb with global parameters objects on /params and distinct > zodb as /foo /bar /baz and so on. > Objects in a zodb may reference objects of the same zodb or of /params. > > I have two possible strategies : > > - either store uuid of referenced objects and retrieve objects from solr > (which will give me a zodb name + intid of object) > - either directly reference the objects of /params > > Of course second option seems better and more natural. > > I read > http://svn.zope.org/ZODB/trunk/src/ZODB/tests/multidb.txt?rev=99605&view=markup > and using pdb on databases = request.environ['zodb.connection'] I can > see the zodb.databases map > which is ok. I also know that _p_oid is unique and _p_jar handled for > each object so I feel confident on this side. > > So before I dive into this, is this kind of cross-database reference > used on production applications. Is there any-risk or any trick to be > aware ? Using cross-database references can be treacherous, because the garbage collection that occurs when packing a ZODB the typical way is not aware of the cross-db references. So if there's an object in one db that is only referenced from a different db, it will get garbage-collected during packing. You can probably use http://pypi.python.org/pypi/zc.zodbdgc instead of standard packing to avoid that problem.
---------- David Glick Web Developer davidgl...@groundwire.org 206.286.1235x32 Online tools and strategies for the environmental movement. Sign up for our newsletter: http://www.groundwire.org/email-capture _______________________________________________ For more information about ZODB, see the ZODB Wiki: http://www.zope.org/Wikis/ZODB/ ZODB-Dev mailing list - ZODB-Dev@zope.org https://mail.zope.org/mailman/listinfo/zodb-dev