[ZODB-Dev] Help: ZODB undo problem

Shane Hathaway shane@zope.com
Wed, 19 Jun 2002 10:09:17 -0400


Mike C. Fletcher wrote:
> Thanks Shane and Christian,
> 
> Unfortunately, I am already using a sync, reset and _resetCache, 
> combination which was what got me from "no objects update" to "only 
> objects with explicit references fail to update".  The code I'm 
> currently using does this:
> 
>     undoInfo = self.database.undoInfo( 0, sys.maxint )
>     if undoInfo:
>         ID = undoInfo[0]['id']
>         self.database.undo(ID)
>         get_transaction().commit()
>         for item in APPLICATION.GetTables():
>             item._v_indices_initialised = 0
>             item.GetIndices()
>         self.connection.reset()
>         self.connection.sync()
>         self.connection._resetCache()

Hmm.  You should look at several things:

1) What is reset()?  My up-to-date CVS checkout of ZODB has no reset() 
method anywhere.  Are you sure this isn't throwing an AttributeError, 
preventing sync() from ever getting called?

2) I'm quite sure you don't want to call _resetCache() anywhere in your 
code, since that partially disconnects your objects from the database, 
and you can expect broken behavior once that happens.  Just trust me, 
don't do it.  I'd do a grep in your code for _resetCache(), and if you 
find any instances anywhere, zap them. :-)  _resetCache() is not part of 
the public API.

3) Is your copy of ZODB up to date?  The trunk ZEO had a bug last week 
that prevented invalidations from propagating; maybe you just need to 
"cvs up".

Shane