Re: Enabling Checksums

Andres Freund <andres@2ndquadrant.com>

From: Andres Freund <andres@2ndquadrant.com>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Greg Smith <greg@2ndquadrant.com>, Bruce Momjian <bruce@momjian.us>, Simon Riggs <simon@2ndquadrant.com>, Tom Lane <tgl@sss.pgh.pa.us>, Ants Aasma <ants@cybertec.at>, Heikki Linnakangas <hlinnakangas@vmware.com>, Jeff Davis <pgsql@j-davis.com>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2013-03-27T14:15:19Z
Lists: pgsql-hackers
On 2013-03-27 10:06:19 -0400, Robert Haas wrote:
> On Mon, Mar 18, 2013 at 4:31 PM, Greg Smith <greg@2ndquadrant.com> wrote:
> > to get them going again.  If the install had checksums, I could have figured
> > out which blocks were damaged and manually fixed them, basically go on a
> > hunt for torn pages and the last known good copy via full-page write.
> 
> Wow.  How would you extract such a block image from WAL?
> 
> That would be a great tool to have, but I didn't know there was any
> practical way of doing it today.

Given pg_xlogdump that should be doable with 5min of hacking in 9.3. Just add
some hunk to write out the page to the if (config->bkp_details) hunk in
pg_xlogdump.c:XLogDumpDisplayRecord. I have done that for some debugging already.

If somebody comes up with a sensible & simple UI for this I am willing to
propose a patch adding it to pg_xlogdump. One would have to specify the
rel/file/node, the offset, and the target file.

Greetings,

Andres Freund

-- 
 Andres Freund	                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services