Re: corrupt pages detected by enabling checksums - Mailing list pgsql-hackers

From Greg Stark
Subject Re: corrupt pages detected by enabling checksums
Date
Msg-id CAM-w4HPBPSuxFEm2RSvx-y8e+CtJVsD9asjrfeAUzsf0VtgpAw@mail.gmail.com
Whole thread Raw
In response to corrupt pages detected by enabling checksums  (Jeff Janes <jeff.janes@gmail.com>)
Responses Re: corrupt pages detected by enabling checksums  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: corrupt pages detected by enabling checksums  (Jeff Janes <jeff.janes@gmail.com>)
Re: corrupt pages detected by enabling checksums  (Amit kapila <amit.kapila@huawei.com>)
List pgsql-hackers
On Fri, May 10, 2013 at 5:31 PM, Amit Kapila <amit.kapila@huawei.com> wrote:
> In the case where one block is missing, how can it even reach to next record
> to check "prev" pointer.
> I think it can be possible when one of the record is corrupt and following
> are okay which I think is the
> case in which it can proceed with warning as suggested by Simon.

A single WAL record can be over 24kB. The checksum covers the entire
WAL record and if it reports corruption it can be because a chunk in
the middle wasn't flushed to disk before the system crashed. The
beginning of the WAL record with the length and checksum and the
entire following record with its prev pointer might have been flushed
but the missing block in the middle of this record means it can't be
replayed. This would be a normal situation in case of a system crash.

If you replayed the following record but not this record you would
have an inconsistent database. The following record could be an insert
for a child table with a foreign key reference to a tuple that was
inserted by the skipped record for example. Resulting in a database
that is logically inconsistent.

Or it could be an index insert for that tuple would would result in a
physically inconsistent database with index pointers that point to
incorrect tuples. Index scans would return tuples that didn't match
the index  or would miss tuples that should be returned.

-- 
greg



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: pgcrypto: Fix RSA password-protected keys
Next
From: Tom Lane
Date:
Subject: Re: corrupt pages detected by enabling checksums