[ZODB-Dev] Corrupt BTree Problem

Dieter Maurer dieter at handshake.de
Fri Jul 9 14:51:21 EDT 2004


mattkoz2003 wrote at 2004-7-7 12:53 -0000:
>Somehow, along the way a BTree has become corrupt.  I don't know 
>how/why - but I need to fix it.  It has been broken for a while 
>(since pre-2.6).  I am now running 2.7.1 w/ ZEO (included with 
>2.7.1).
>
>Here is the problem.  When I do this:
>
>for key in self.data.keys():
>    postings.append(key)
>return str(postings)
>
>it returns all the keys, including 1063958497.  However, when I do 
>this:  return self.data[1063958497], I get a KeyError.

Try something like:

     newTree = BTreeXXX(self.data) # copy the tree
     self.data.clear()             # clear the corrupt one
     self.data.update(newTree)     # add old content again

Of course, the newly build tree may get inconsistent again
if the keys do not fulfill the requirements Tim posted some
time ago: they must be persistently ordered; they should not be persistent.


-- 
Dieter


More information about the ZODB-Dev mailing list