[ZODB-Dev] Repair corrupted RelStorage database

Shane Hathaway shane at hathawaymix.org
Sat Jan 30 03:56:36 EST 2010


Rudá Porto Filgueiras wrote:
> How can I repair or verify a RelStorage database?
> I´m using MySQL Adapter, there is any script like fsrecover.py
> 
> Follow the failure when RelStorage try to load some objects:
> 
> 2010-01-30T04:25:14 ERROR ZODB.Connection Couldn't load state for 0x04ef0f59
> Traceback (most recent call last):
>   File 
> "/usr/local/zope-agecom/plone/eggs/ZODB3-3.8.4_polling-py2.4-linux-x86_64.egg/ZODB/Connection.py", 
> line 847, in setstate
>     self._setstate(obj)
>   File 
> "/usr/local/zope-agecom/plone/eggs/ZODB3-3.8.4_polling-py2.4-linux-x86_64.egg/ZODB/Connection.py", 
> line 888, in _setstate
>     p, serial = self._storage.load(obj._p_oid, self._version)
>   File 
> "/usr/local/zope-agecom/plone/eggs/RelStorage-1.4.0b1-py2.4.egg/relstorage/storage.py", 
> line 432, in load
>     raise POSKeyError(oid)
> POSKeyError: 0x04ef0f59

To diagnose this, I would:

- Examine the logs in detail.  There should be a log entry giving 
details about that specific POSKeyError.

- Shut down MySQL and back up the database as-is.

- Run the MySQL database verification and repair tools.  It's possible 
that the object you need is there, but MySQL can't find it due to 
corrupted indexes or similar.

- Run a pack in dry-run mode, which will fill the object_refs table so I 
can find out exactly what object(s) refer to that OID (note that 
0x04ef0f59 is 82775897 in decimal).

- Use both SQL and "zopectl debug" to examine the breakage.

Running a pack in dry-run mode performs verification without actually 
deleting anything.  There is no fsrecover-like script, but I could be 
convinced to create one if the need arises.

Shane


More information about the ZODB-Dev mailing list