Re: 16-bit page checksums for 9.2 - Mailing list pgsql-hackers

From Ants Aasma
Subject Re: 16-bit page checksums for 9.2
Date
Msg-id CA+CSw_sKa7cOa3JhGpro3secET0RZfDFdz2N1JMsPa8Lzs=NZg@mail.gmail.com
Whole thread Raw
In response to Re: 16-bit page checksums for 9.2  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
Responses Re: 16-bit page checksums for 9.2  (Nicolas Barbier <nicolas.barbier@gmail.com>)
Re: 16-bit page checksums for 9.2  (Jeff Janes <jeff.janes@gmail.com>)
List pgsql-hackers
On Thu, Dec 29, 2011 at 6:44 PM, Kevin Grittner
<Kevin.Grittner@wicourts.gov> wrote:
> positives.  To get this right for a checksum in the page header,
> double-write would need to be used for all cases where
> full_page_writes now are used (i.e., the first write of a page after
> a checkpoint), and for all unlogged writes (e.g., hint-bit-only
> writes).  There would be no correctness problem for always using
> double-write, but it would be unnecessary overhead for other page
> writes, which I think we can avoid.

Unless I'm missing something, double-writes are needed for all writes,
not only the first page after a checkpoint. Consider this sequence of
events:

1. Checkpoint
2. Double-write of page A (DW buffer write, sync, heap write)
3. Sync of heap, releasing DW buffer for new writes.... some time goes by
4. Regular write of page A
5. OS writes one part of page A
6. Crash!

Now recovery comes along, page A is broken in the heap with no
double-write buffer backup nor anything to recover it by in the WAL.

--
Ants Aasma


pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: failed regress test
Next
From: Tom Lane
Date:
Subject: Re: SEGFAULT on SELECT * FROM view