[ZODB-Dev] Missing loader for multidatabase refs?

Jim Fulton jim at zope.com
Fri Mar 30 09:57:50 EDT 2007


On Mar 30, 2007, at 9:27 AM, Sidnei da Silva wrote:

> On 3/30/07, Jim Fulton <jim at zope.com> wrote:
>> > Now my question is, should 'referencesf' load those multi-database
>> > references, or should they be treated just like the 'weak  
>> references',
>> > by returning None, or should something else happen?
>>
>> They should be treated as weak references, at least for now.
>
> Would that cause any problem?

No.

> Say there's two databases, and the
> object in database '1' is the only one referencing some object in
> database '2'. Since those references would be treated like weak
> references, wouldn't the object in database '2' go away in a 'pack',
> thus causing a PosKeyError when loading the object from database '1'
> that still points to it?

Yes. That is a limitation of cross-database references.

Note that treating the references differently in a pack can't help  
this as the references are in the referencing database, not the  
referenced database.

It would be cool to have:

- A multi-database pack that took multiple databases into account.
   Such a feature is doable, but obviously, non-trivial.

- A non-GC pack that got rid of old records but didn't bother with GC.
   This would be advantagious for lots of folks independent of cross- 
database reference issues.

>
>> > Or maybe that
>> > reference shouldn't be there in the first place?
>>
>> Where?  There references should certainly be in the data records,
>> otherwise, cross-database references wouldn't work at all.
>
> Right. I'm wondering how I did end up with a cross-database reference.
> Seems like a copy/paste through the ZMI caused it. My question is if
> that's expected/correct.

Cross database references are pretty transparent and automatic.

Maybe there should be an option to make them less so.

>
>> > This problem is preventing us from packing a database. It just  
>> falls
>> > dead with the KeyError 'n' when packing.
>>
>> What version of ZODB are you using?
>
> The one included with Zope 2.9.6.

Hm, are you using ZEO?

I'm wondering what sort of release would be needed to help you out.

Jim

--
Jim Fulton			mailto:jim at zope.com		Python Powered!
CTO 				(540) 361-1714			http://www.python.org
Zope Corporation	http://www.zope.com		http://www.zope.org





More information about the ZODB-Dev mailing list