Detecting corrupted pages earlier - Mailing list pgsql-hackers

From Tom Lane
Subject Detecting corrupted pages earlier
Date
Msg-id 10240.1045510863@sss.pgh.pa.us
Whole thread Raw
Responses Re: Detecting corrupted pages earlier  (Sailesh Krishnamurthy <sailesh@cs.berkeley.edu>)
Re: Detecting corrupted pages earlier  (Curt Sampson <cjs@cynic.net>)
List pgsql-hackers
Postgres has a bad habit of becoming very confused if the page header of
a page on disk has become corrupted.  In particular, bogus values in the
pd_lower field tend to make it look like there are many more tuples than
there really are, and of course these "tuples" contain garbage.  That
leads to core dumps, weird complaints about out-of-range transaction
numbers (the latter generally in the form of an abort referencing a
nonexistent pg_clog file), and other un-fun stuff.

I'm thinking of modifying ReadBuffer() so that it errors out if the
page read in does not contain either zeroes or a valid-looking header.
(The exception for zeroes seems to be needed for hash indexes, which
tend to initialize pages out-of-order.)  This would make it much easier
for people to recognize situations where a page header has become
corrupted on disk.

Comments?  Can anyone think of a scenario where this would be a bad
idea?
        regards, tom lane


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: new Configuration patch, implements 'include'
Next
From: Sailesh Krishnamurthy
Date:
Subject: Re: Detecting corrupted pages earlier