osdir.com
mailing list archive

Subject: Re: weird BTrees KeyError (CVS HEAD) - msg#00197

List: web.zope.zodb

Date: Prev Next Index Thread: Prev Next Index
On Fri, Jun 27, 2003 at 02:22:40PM -0400, Jeremy Hylton wrote:
> On Fri, 2003-06-27 at 14:13, Christian Reis wrote:
> > I have a BTree (held by ListIndex for the IC-interested) that uses
> > PersistentLists as keys. I'm running into the following situation:
>
> Unless you are very careful, it is not safe to use a PersistnetList as a
> BTree key. If the PersistentList is ever mutated, it may not have the
> same place in the total order of the keys. Are you sure that these
> lists are never mutated and that their contents are totally ordered?

Would a normal list be safe, even while mutating?

This really looks like a race condition, having said that (since the
error is not 100% consistent)..

Take care,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 261 2331 | NMFL

_______________________________________________
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list - ZODB-Dev@xxxxxxxx
http://mail.zope.org/mailman/listinfo/zodb-dev



Was this page helpful?
Yes No
Thread at a glance:

Previous Message by Date: click to view message preview

Re: weird BTrees KeyError (CVS HEAD)

On Fri, 2003-06-27 at 14:13, Christian Reis wrote: > I have a BTree (held by ListIndex for the IC-interested) that uses > PersistentLists as keys. I'm running into the following situation: Unless you are very careful, it is not safe to use a PersistnetList as a BTree key. If the PersistentList is ever mutated, it may not have the same place in the total order of the keys. Are you sure that these lists are never mutated and that their contents are totally ordered? Jeremy _______________________________________________ For more information about ZODB, see the ZODB Wiki: http://www.zope.org/Wikis/ZODB/ ZODB-Dev mailing list - ZODB-Dev@xxxxxxxx http://mail.zope.org/mailman/listinfo/zodb-dev

Next Message by Date: click to view message preview

RE: weird BTrees KeyError (CVS HEAD)

[Christian Reis] > Would a normal list be safe, even while mutating? It's never safe to mutate an object used as a BTree key, regardless of its type. Please see: http://www.zope.org/Wikis/ZODB/guide/node6.html and esp. section 5.3.1 (Total Ordering and Persistence). There wasn't enough info in your original msg to guess what might have gone wrong with high probability. Something you can do is load your BTree, import the check module from the BTrees package, and execute check.check(index) If mutations have destroyed that the BTree's keys are in sorted order, that line will raise AssertionError with some more info. > This really looks like a race condition, having said that (since the > error is not 100% consistent).. Reading the page referenced above will expand your sense of how many other things might be going wrong <wink>. > ... > The only thing really special here is that these objects have > custom hash functions, but I don't think hash is used in this case. Right, BTrees never use hash functions. How these objects define __cmp__ is vital, though, and if they don't have a custom __cmp__ function, sporadic and seemingly random errors are *expected* (see the page referenced above for why). _______________________________________________ For more information about ZODB, see the ZODB Wiki: http://www.zope.org/Wikis/ZODB/ ZODB-Dev mailing list - ZODB-Dev@xxxxxxxx http://mail.zope.org/mailman/listinfo/zodb-dev

Previous Message by Thread: click to view message preview

Re: weird BTrees KeyError (CVS HEAD)

On Fri, 2003-06-27 at 14:13, Christian Reis wrote: > I have a BTree (held by ListIndex for the IC-interested) that uses > PersistentLists as keys. I'm running into the following situation: Unless you are very careful, it is not safe to use a PersistnetList as a BTree key. If the PersistentList is ever mutated, it may not have the same place in the total order of the keys. Are you sure that these lists are never mutated and that their contents are totally ordered? Jeremy _______________________________________________ For more information about ZODB, see the ZODB Wiki: http://www.zope.org/Wikis/ZODB/ ZODB-Dev mailing list - ZODB-Dev@xxxxxxxx http://mail.zope.org/mailman/listinfo/zodb-dev

Next Message by Thread: click to view message preview

RE: weird BTrees KeyError (CVS HEAD)

[Christian Reis] > Would a normal list be safe, even while mutating? It's never safe to mutate an object used as a BTree key, regardless of its type. Please see: http://www.zope.org/Wikis/ZODB/guide/node6.html and esp. section 5.3.1 (Total Ordering and Persistence). There wasn't enough info in your original msg to guess what might have gone wrong with high probability. Something you can do is load your BTree, import the check module from the BTrees package, and execute check.check(index) If mutations have destroyed that the BTree's keys are in sorted order, that line will raise AssertionError with some more info. > This really looks like a race condition, having said that (since the > error is not 100% consistent).. Reading the page referenced above will expand your sense of how many other things might be going wrong <wink>. > ... > The only thing really special here is that these objects have > custom hash functions, but I don't think hash is used in this case. Right, BTrees never use hash functions. How these objects define __cmp__ is vital, though, and if they don't have a custom __cmp__ function, sporadic and seemingly random errors are *expected* (see the page referenced above for why). _______________________________________________ For more information about ZODB, see the ZODB Wiki: http://www.zope.org/Wikis/ZODB/ ZODB-Dev mailing list - ZODB-Dev@xxxxxxxx http://mail.zope.org/mailman/listinfo/zodb-dev
Sign up for updates to this mailing list. email:
Loading Comments...
Home | News | Patents | Sitemap | FAQ | advertise

Advertising by