[ZODB-Dev] KeyError on OIBTree after export import

Dieter Maurer dieter at handshake.de
Wed Mar 14 14:16:03 EDT 2007


Bernd Dorn wrote at 2007-3-14 11:39 +0100:
> ...
>but after the import in the .ids attribute of the util (which is an  
>OIBtree) raises a KeyError for an existing key
>
>so if i do
>
> >>> key in sorted(self.ids)
>True
> >>> self.ids[key]
>KeyError ...

I can explain to you why you may get different results (also I cannot
tell you why you have the inconsistency).

An XYBTree uses two different structures for the enumeration of
its elements (e.g. "iter(tree)") and the random access (e.g. tree[key]).

The tree root has a link to its left most leaf and all
leaves are linked together. These links use used for enumeration.

Random access uses the internal nodes to find the leaf that may
contain the key and then access it there.


What you see means that the leaf links are correct but some
internal node is broken (contains a stale reference).



-- 
Dieter


More information about the ZODB-Dev mailing list