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

Vincent Pelletier vincent at nexedi.com
Tue Sep 27 11:45:12 EST 2011


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).
-- 
Vincent Pelletier
ERP5 - open source ERP/CRM for flexible enterprises


More information about the ZODB-Dev mailing list