[ZODB-Dev] Recovering from POSKeyErrors

ethan fremen lists at mindlace.net
Mon Jan 24 16:18:55 EST 2005


http://mindlace.net/src/zodb/killthem.py is the script I wrote to
recover from POSKeyErrors. It is guaranteed to cause data loss. It will
not work if any of your objects is incapable of returning .objectItems()
or doing .manage_delObjects() .

It is intended for use as follows:

$ zeoctl debug
>>> from killthem import killthem
>>> all = app.unrestrictedTraverse('/path/to/folder')
>>> killthem(all)

It will print a report of what object IDs it deletes. It traverses all
objects below the first. It is reasonably conservative with memory use.

As an (untested) option you may elect to destroy objects that raise some
other exception, like:

$ zeoctl debug
>>> from killthem import killthem
>>> from exceptions import Exception as LordKnows
>>> all = app.unrestrictedTraverse('/path/to/folder')
>>> killthem(all, excepting=LordKnows)

The above is a very bad idea that deletes all objects that raise any
exceptions.

Caedite-eos! Novit-enim-Dominus-qui-sunt-eius-ly y'rs,

~ethan fremen



More information about the ZODB-Dev mailing list