[ZODB-Dev] mvcc related error?

Jeremy Hylton jeremy at alum.mit.edu
Thu Mar 15 10:23:49 EDT 2007

On 3/15/07, Chris Withers <chris at simplistix.co.uk> wrote:
> Dieter wrote:
> >
> >>> Unfortunately, neither of these means anything to me ;-)
> >>
> >> That is because you did not look at the code :-)
> Much as I wish I had time to read and learn the whole zodb code base, I
> don't. It wasn't clear what that code did and what those assertions
> really meant...

The code in question has some docstrings that explain the basic idea.
You certainly don't need to read the whole codebase.

_setstate_noncurrent(obj) attempts to load the state of obj that was
current before the transaction started (technically, before
_txn_time).  loadBefore() returns a 3-tuple including the transaction
ids the delimit the lifetime of this particular revision of the
object.  It was written by transaction start and was current until
transaction end committed.  If end is None, it implies that the
revision returned by loadBefore() is the current revision.  There is
an assert here, because the _setstate_noncurrent() is only called if
the object is in the invalidated set, which implies that there is a
non-current revision to read.

If I had to guess, I'd say it was a bug in loadBefore().  It looks
like the only ways for loadBefore() to return None for end are
- The very first record for the object has a transaction id less than
the tid argument.  If so, end_tid is never set.  Not sure this is
compatible with the object being in the invalidated set.
- Something is happening with versions.  Are you using versions?  It
seems likely that there are bugs here.
- There's a bug in the code that reads the data record from the
storage where it reads None for a transaction id.  That seems very

Perhaps the reasoning about invalidated sets and transaction ids is
wrong in the presence of versions.  MVCC should not work with
versions, but I don't see code that will abort the loadBefore() call
if the Connection has a version.  You aren't using versions, are you?



> Jim wrote:
> > I'm glad you brought that up.  I'd like to set up a project in Launchpad.
> https://bugs.launchpad.net/zodb/+bug/92507
> cheers,
> Chris
> --
> Simplistix - Content Management, Zope & Python Consulting
>             - http://www.simplistix.co.uk
> _______________________________________________
> For more information about ZODB, see the ZODB Wiki:
> http://www.zope.org/Wikis/ZODB/
> ZODB-Dev mailing list  -  ZODB-Dev at zope.org
> http://mail.zope.org/mailman/listinfo/zodb-dev

More information about the ZODB-Dev mailing list