Re: CRCs - Mailing list pgsql-hackers

From Tom Lane
Subject Re: CRCs
Date
Msg-id 23654.979340781@sss.pgh.pa.us
Whole thread Raw
In response to Re: CRCs  (ncm@zembu.com (Nathan Myers))
Responses Re: CRCs  (ncm@zembu.com (Nathan Myers))
List pgsql-hackers
ncm@zembu.com (Nathan Myers) writes:
>>>>>> "Changes must be logged *before* changed data pages written".
>>>>>> If this rule will be broken then data files will be inconsistent
>>>>>> after crash recovery and you will not notice this, w/wo CRC in
>>>>>> data blocks.
>>>> 
>>>> You can include the data blocks' CRCs in the log entries.
>> 
>> How could it help?

> It wouldn't help you recover, but you would be able to report that 
> you cannot recover.

How?  The scenario Vadim is pointing out is where the disk drive writes
a changed data block in advance of the WAL log entry describing the
change.  Then power drops and the WAL entry never gets made.  At
restart, how will you realize that that data block now contains data you
don't want?  There's not even a log entry telling you you need to look
at it, much less one that tells you what should be in it.

AFAICS, disk-block CRCs do not guard against mishaps involving intended
writes.  They will help guard against data corruption that might creep
in due to outside factors, however.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Ian Lance Taylor
Date:
Subject: Re: CVS updates on committers list...
Next
From: "Mikheev, Vadim"
Date:
Subject: RE: CRCs