[ZODB-Dev] More exciting ZODB errors ;-)

Jeremy Hylton jeremy at alum.mit.edu
Wed Dec 14 12:50:08 EST 2005


On 12/14/05, Tim Peters <tim at zope.com> wrote:
> Jeremy, the code at the start of _setstate() looks fishy:  any idea what the
> intent was?:
>
>         # There is a harmless data race with self._invalidated.  A
>         # dict update could go on in another thread, but we don't care
>         # because we have to check again after the load anyway.
>
>         if (obj._p_oid in self._invalidated
>             and not myhasattr(obj, "_p_independent")
>             and not self._invalidated
>             ):
>             # If the object has _p_independent(), we will handle it below.
>             self._load_before_or_conflict(obj)
>             return

I don't have any idea what the intent of "not self._invalidated" was. 
I looked back at 3.3a2, which I think was the first MVCC release.  It
doesn't have the "and not self._invalidated" line , and I can't think
of why it would.  The code is just an optimization; it's trying to
avoid loading the current version if it knows that it needs a
non-current version.

I don't have a checkout of ZODB, so I can't check the svn blame.  Does
it say who wrote the code and what change it was related to?

Jeremy

>
> Specifically, how could:
>
>     obj._p_oid in self._invalidated
>
> and:
>
>     not self._invalidated
>
> be true at the same time?  The latter says _invalidated is empty, but the
> former can't be true if _invalidated is empty.  Offhand, then, unless we're
> _counting_ on a thread race here ;-), it looks impossible that the body of
> this `if` could execute.
>
> I don't have a reason to believe it's directly relevant to Chris's problem,
> it's just that I got baffled by the first thing I looked at ;-)
>
>


More information about the ZODB-Dev mailing list