[Zope] CorruptedDataError: How to fix a corrupted

Martijn Pieters mj at zopatista.com
Fri Aug 1 13:29:18 EDT 2008


On Fri, Aug 1, 2008 at 7:01 PM, Remy Pinsonnault
<remypinsonnault at gmail.com> wrote:
> I tried fsdump but it did not work I got a FileStorageFormatError...

You only get that error if a) the first four bytes of the file are not
'FS21', or b) the file is smaller than 4 bytes. Are you sure you were
trying this on the corrupted Data.fs? If so, you may have a bigger
problem on your hands.

> Is there any other way I can obtain the needed paramater (position) for the
> truncate function where the CorruptedDataError occured?

The exception included the position: 10020462. I just advised you to
double-check it.

> Another question, is there a way of extracting all data or transaction
> between two dates?

Take a look at what fsdump.py does, it uses a FileIterator to list all
transactions in the Data.fs. The returned objects (RecordIterators)
represent the transactions and you can iterate over these to pull out
all data associated with the transaction. Each transaction id is based
on the timestamp (use ZODB.TimeStamp.TimeStamp to decode it) so it
should be but a small job to extract everything between two given
dates.

See the sourcecode for fsdump.py and FileStorage.py in ZODB/FileStorage.

-- 
Martijn Pieters


More information about the Zope mailing list