[Zope-dev] Conflict Errors

Chris McDonough chrism@digicool.com
Tue, 2 Jan 2001 12:41:05 -0500


Y'know since replying to this message originally, I've learned a lot about
pickled representations of Zope objects and I think I can answer this more
cogently:

- Instances of classes which inherit from Persistence.Persistent are
represented as an individual pickle.  Their attributes are contained in this
pickle, unless those attributes are themselves instances of something that
inherits from Persistence.Persistent.

- References to persistent objects in other objects are kept as an object
identifier.  This means, for example, that a dictionary of integers to
persistent object instances looks something like this in a pickle::

  {1:<<oid 1>>, 2:<<oid 2>>, ...}

  If this dictionary is an attribute of a persistent object, adding,
changing, or removing items from it will modify its containing persistent
object.

It was this "reference by oid" concept that turned the light on for me here,
hopefully it can do the same for you.

One of the potential big wins with the current Zope implementation of a
BTree is that it exposes a mapping interface, so you can treat it just like
a dictionary.  However, internally, it's composed of a number of separate
persistent objects that can be changed independently of each other.  This
means that changing one item in a BTree will change one persistent object
that makes up a BTree, but will not necessarily effect the other persistent
objects that compose it.  Unortunately, currently, the BTree implementation
has some problems that cause that *not* to be the case in many situations,
and independent writes to it often conflict.  We are working on another
BTree implementation to resolve the issue.

----- Original Message -----
From: "Chris Withers" <chrisw@nipltd.com>
To: "Chris McDonough" <chrism@digicool.com>
Cc: <zope-dev@zope.org>
Sent: Tuesday, January 02, 2001 11:50 AM
Subject: Re: [Zope-dev] Conflict Errors


> Chris McDonough wrote:
> >
> > The ZODB tries
> > hard to avoid error conditions for you by retrying conflicting writes,
but
> > if you really pound the snot out of a particular object, it'll let you
know.
>
> That's gotta be one for the Zope quotes board, if I could onyl remember
> the URL :-)
>
> > and step through a real-world ConflictError situation.  Neither of which
I
> > have time to do right now... sorry, Chris.
> >
> > this one by saying "I don't know" because it's one of those things where
> > learning exactly what is going on can chew up time like nobody's
business,
> > because I'd need to step through the code line-by-line.  I shouldn't
even be
> > in here.  :-(
>
> Hey, no problem, the help was much appreciated :-)
>
> However, if anyone does know what constitutes a 'seperate object' in
> ZODB terms, it be really useful to know.
> I'm guessing a class which inherits from Persistent? Dictionaries don't,
> 'cos they're python builtins, which I'm pretty certain was the problem
> in my case...
>
> cheers,
>
> Chris
>