Re: Block-level CRC checks - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: Block-level CRC checks
Date
Msg-id 48E27758.9060402@enterprisedb.com
Whole thread Raw
In response to Block-level CRC checks  (Alvaro Herrera <alvherre@commandprompt.com>)
Responses Re: Block-level CRC checks  (Florian Weimer <fweimer@bfk.de>)
List pgsql-hackers
Alvaro Herrera wrote:
> Initially I'm aiming at a CRC32 sum
> for each block.  FlushBuffer would calculate the checksum and store it
> in the CRC fork; ReadBuffer_common would read the page, calculate the
> checksum, and compare it to the one stored in the CRC fork.

There's one fundamental problem with that, related to the way our hint 
bits are written.

Currently, hint bit updates are not WAL-logged, and thus no full page 
write is done when only hint bits are changed. Imagine what happens if 
hint bits are updated on a page, but there's no other changes, and we 
crash so that only one half of the new page version makes it to disk (= 
torn page). The CRC would not match, even though the page is actually valid.

--   Heikki Linnakangas  EnterpriseDB   http://www.enterprisedb.com


pgsql-hackers by date:

Previous
From: Markus Wanner
Date:
Subject: Re: Block-level CRC checks
Next
From: Greg Smith
Date:
Subject: Re: Block-level CRC checks