[ZODB-Dev] Re: self.length._p_deactivate() and MVCC

Casey Duncan casey at zope.com
Fri Apr 30 09:15:30 EDT 2004


On Fri, 30 Apr 2004 08:37:42 -0400
Jeremy Hylton <jeremy at alum.mit.edu> wrote:

> On Fri, 2004-04-30 at 04:03, Thomas Güttler wrote:
> > By chance I came across this comment
> > in the code of Lexicon.py of ZCTextIndex.py:
> > 
> >     def sourceToWordIds(self, text):
> >         last = _text2list(text)
> >         for element in self._pipeline:
> >             last = element.process(last)
> >         if not hasattr(self.length, 'change'):
> >             # Make sure length is overridden with a
> >             # BTrees.Length.Length
> >             self.length = Length(self.length())        
> >         # Strategically unload the length value so that we get the
> >         # most recent value written to the database to minimize
> >         # conflicting wids XXX this will not work when MVCC is
> >         # implemented in the ZODB...
> >         self.length._p_deactivate() # <------------------------
> >         return map(self._getWordIdCreate, last)
> > 
> > Can someone explain this, and why this does not work with MVCC?
> 
> I think the person who wrote the comment believed that the old value
> of length would be loaded again if MVCC was enabled.  The Length
> object has an _p_independent() method, however.  The return value of
> that method tells ZODB whether it is okay to read a revision of the
> object that is inconsistent with other objects.  Length's
> _p_independent() always returns 1, so ZODB will always read the most
> current revision.

I wrote the comment based on speculative semantics for MVCC. It looks
like it will still work as intended with MVCC as it is now implemented,
so I will remove the comment.

Thanks for clarifying!

-Casey




More information about the ZODB-Dev mailing list