[ZODB-Dev] Weird KeyError with OOBTree

Pedro Ferreira jose.pedro.ferreira at cern.ch
Mon Aug 16 06:14:06 EDT 2010


Hello all,

I am running out of ideas, so I though maybe someone could help me spot 
the problem in this one.
I have created a minimal example that reproduces the problem - 
basically, i have an OOBTree where keys are persistent objects and 
values are IOTreeSets. I am just storing elements, closing the 
transaction after each operation. Around the 600th element (sometimes 
900th, it varies but seems to never reach 1000) a KeyError is thrown, 
just as if the operation in the previous line hadn't been performed.  If 
i comment out the db instructions, everything runs as expected.

This is what I get when I run the code:
"""
[...]
604 <BTrees.IOBTree.IOTreeSet object at 0x84fc38c>
605 <BTrees.IOBTree.IOTreeSet object at 0x84fc3d4>
606 <BTrees.IOBTree.IOTreeSet object at 0x844b1dc>
607 <BTrees.IOBTree.IOTreeSet object at 0x84fc41c>
608 <BTrees.IOBTree.IOTreeSet object at 0x84fc4ac>
609
Traceback (most recent call last):
   File "test-zodb.py", line 40, in <module>
     struct.index_obj(obj, i)
   File "test-zodb.py", line 20, in index_obj
     print number, self._idx[obj]
KeyError: <__main__.DummyObject object at 0x844822c>
"""

Could this be some problem with using persistent objects as keys in a 
BTree? Some comparison problem?

Any help would be much appreciated :)

Thanks,

Pedro
-------------- next part --------------
A non-text attachment was scrubbed...
Name: oobtree.py
Type: application/x-python
Size: 804 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zodb-dev/attachments/20100816/b7e0d506/attachment.bin 


More information about the ZODB-Dev mailing list