Re: Enabling Checksums - Mailing list pgsql-hackers

From Greg Stark
Subject Re: Enabling Checksums
Date
Msg-id CAM-w4HMkUBaGo1jQCAYJyRFnOju1yioz6Z7QrpSTawvk7EiapQ@mail.gmail.com
Whole thread Raw
In response to Re: Enabling Checksums  (Simon Riggs <simon@2ndQuadrant.com>)
Responses Re: Enabling Checksums
List pgsql-hackers
On Fri, Apr 12, 2013 at 9:42 PM, Simon Riggs <simon@2ndquadrant.com> wrote:
> * WAL checksum is not used as the sole basis for end-of-WAL discovery.
> We reuse the WAL files, so the prev field in each WAL record shows
> what the previous end of WAL was. Hence if the WAL checksums give a
> false positive we still have a double check that the data really is
> wrong. It's unbelievable that you'd get a false positive and then have
> the prev field match as well, even though it was the genuine
> end-of-WAL.

This is kind of true and kind of not true. If a system loses power
while writing lots of data to WAL then the blocks at the end of the
WAL might not be written out in order. Everything since the last log
sync might be partly written out and partly not written out. That's
the case where the checksum is critical. The beginning of a record
could easily be written out including xl_prev and the end of the
record not written. 1/64,000 power losses would then end up with an
assertion failure or corrupt database.



-- 
greg



pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: COPY and Volatile default expressions
Next
From: Peter Eisentraut
Date:
Subject: Re: event trigger API documentation?