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

From Martijn van Oosterhout
Subject Re: Block-level CRC checks
Date
Msg-id 20081030183426.GB21451@svana.org
Whole thread Raw
In response to Re: Block-level CRC checks  (Gregory Stark <stark@enterprisedb.com>)
List pgsql-hackers
On Thu, Oct 30, 2008 at 03:41:17PM +0000, Gregory Stark wrote:
> The CRC is chosen such that if you CRC the resulting packet including the CRC
> you get a CRC of 0. That can be done for whatever offset the CRC appears at I
> believe.

IIRC, you calculate the CRC-32 of the page, then XOR it over where it's
supposed to end up. No need to preseed (or more accurately, it doesn't
matter how you preseed, the result is the same).

For checking it doesn't matter either, just checksum the page and if
you get zero it's correct.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Please line up in a tree and maintain the heap invariant while
> boarding. Thank you for flying nlogn airlines.

pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Block-level CRC checks
Next
From: Martin Pihlak
Date:
Subject: Re: contrib/pg_stat_statements