[ZODB-Dev] Corrupt BTree Problem

Tim Peters tim at zope.com
Sun Jul 11 23:56:22 EDT 2004


[mattkoz2003]
>> 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.

[Dieter Maurer]
> 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

That's the recipe mattkoz2003 was pointed at before, in the "BTree
Diagnostic Tools" section at the end of

    http://zope.org/Wikis/ZODB/FrontPage/guide/node6.html

He tried something in response to that (I'm not sure exactly what), said it
completely destroyed his BTree, and didn't respond to followup msgs.

> 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.

Those rules are also recorded on the page above (believe it or not, I do try
to update the docs -- sometimes <wink>).  It looks like mattkoz2003's tree
has integer keys, though, and if so there's nothing to worry about there.



More information about the ZODB-Dev mailing list