[ZODB-Dev] the difference between normal class object and the ZODB Persistent subclass object

Jim Fulton jim at zope.com
Tue Sep 27 13:34:46 EST 2011


On Tue, Sep 27, 2011 at 12:45 PM, Vincent Pelletier <vincent at nexedi.com> wrote:
> Le mardi 27 septembre 2011 12:47:42, Jim Fulton a écrit :
>> Generally speaking, clases and methods are not stored in the database,
>> only class names.
>
> (This mail is out of topic... Probably only interesting to ZODB gurus.)
>
> This reminds me of something suspicious in ZODB code.
> I think there is a bug when creating ghosts (when loading class name).
>
> When loading object *state*, the following dance happens
>  (Connection._setstate):
> - if oid is in "pending invalidation" queue, loadBefore and return
> - load
> - if oid is in "pending invalidation" queue, loadBefore
>  (in case some invalidation was not received, and this works because/as long
>  as loads and invalidations occur on an ordered link, such as a single TCP
>  socket)
> - return
>
> But, when reading object's class when generating a ghost (Connection.get),
> there is a single "load", so if object class changed, the ghost will be of the
> wrong class.
>
> I think this bug was originally noticed by Julien (so CC'ed).

I may be contradicting a past self, but changing an object's class is
unsupported and bound to cause pain and agony.

Jim

-- 
Jim Fulton
http://www.linkedin.com/in/jimfulton


More information about the ZODB-Dev mailing list