Duplicated keys in BTreeFolder2
Hi, I currently use a BTreeFolder2 inherited class, called "users", to store my site users profiles. My problem is that for a few records (~50 for 5700 users), I have duplicated keys in my folder, pointing to the same record ; if I remove one of these records, the other keys stay into the folder, pointing to nothing !! My questions now are : - how can I avoid these duplicated keys (as long as I only add my users profiles via a simple Python script which shouldn't break keys, with : if not context.users.has_key(username): context.users.manage_addProduct['MyProduct'].manage_addUserProfile(username) - is it possible to rebuild the folder keys, without breaking the pointed records ?? Thanks, Thierry -- Linux every day, keeps Dr Watson away... http://gpc.sourceforge.net -- http://www.ulthar.net
FLORAC Thierry wrote at 2004-1-21 11:57 +0100:
I currently use a BTreeFolder2 inherited class, called "users", to store my site users profiles. My problem is that for a few records (~50 for 5700 users), I have duplicated keys in my folder, pointing to the same record ; if I remove one of these records, the other keys stay into the folder, pointing to nothing !!
I think this should not happen... The BTrees expert is Tim Peters and he listens on "zodb-dev@zope.org". Check the validity of the "_tree" attribute in your "BTreeFolder2". There are several checks in the "BTrees" package. It is quite easy to corrupt a BTree when you add keys without persistent order (e.g. because they are mutable).
My questions now are : - how can I avoid these duplicated keys (as long as I only add my users profiles via a simple Python script which shouldn't break keys, with :
Read Tim's messages about "BTrees" and its key requirements (--> "zodb-dev@zope.org"). -- Dieter
participants (2)
-
Dieter Maurer -
FLORAC Thierry