[Zope-Coders] Zope test results
Shane Hathaway
shane@zope.com
Wed, 12 Jun 2002 11:51:01 -0400
Jeremy Hylton wrote:
>>>>>>"CM" == Chris McDonough <chrism@zope.com> writes:
>>>>>
>
> CM> This is actually not a Transience bug but a bug in either
> CM> OFS.ObjectManager or ZODB (depending on your point of view)
> CM> exposed by the Transience test suite and the recent changes to
> CM> ZODB.
>
> Thanks for all the details!
>
> CM> I'm not sure whether ObjectManager should be fixed or ZODB that
> CM> should be fixed or both. I didn't dig too much into the
> CM> rationale for setting up the subobject's _p_jar immediately,
> CM> does anybody have a good handle on how this helps the copy
> CM> machinery?
>
> I just asked Jim about it and he thinks ZODB should ignore
> invalidations on objects that have a jar but not an oid. I don't
> think that's the whole story, but it is part of the complete answer.
I'm thinking that perhaps it should actually be an error. In the past
couple of hours we've discovered three places that set _p_jar but not
_p_oid. Every one of them were wrong and probably created strange bugs.
> I wonder if we need to add a method on the ZODB Connection to
> "register" an object before the Transaction manager registers it.
> That might be a more explicit way to accomplsu what setting _p_jar
> does, and would allow the Connection to do whatever bookkeeping it
> needs to stay sane.
That sounds very interesting, though I could interpret that two ways:
1) Connection.register(object) will set the _p_jar (and perhaps _p_oid)
of the object, if it has not already been set, then call
get_transaction().register(object). cPersistence will call
_p_jar.register() instead of get_transaction().register().
2) Connection.register(object) will set the _p_jar (and perhaps _p_oid)
of the object. It will simply return. cPersistence will not change.
I'd really like to see option 1, since in my own ZODB experiments I've
frequently had to patch Transaction.register(). If I could just
override Connection.register() in my subclass, the code would be much
cleaner. I think the performance impact would be very small.
Shane