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

From Alvaro Herrera
Subject Re: Block-level CRC checks
Date
Msg-id 20081113180000.GC4062@alvh.no-ip.org
Whole thread Raw
In response to Re: Block-level CRC checks  (Gregory Stark <stark@enterprisedb.com>)
Responses Re: Block-level CRC checks  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Block-level CRC checks  (Aidan Van Dyk <aidan@highrise.ca>)
Re: Block-level CRC checks  ("Jaime Casanova" <jcasanov@systemguards.com.ec>)
List pgsql-hackers
Gregory Stark wrote:

> I think we're talking past each other. Martin and I are talking about doing
> something like:
>
> for (...)
>   ...
>   crc(word including hint bits)
>   ...
> for (each line pointer)
>   crc-negated(word & LP_DEAD<<15)
>
> Because CRC is a cyclic checksum it's possible to add or remove bits
> incrementally.

I see.

Since our CRC implementation is a simple byte loop, and since ItemIdData
fits in a uint32, the attached patch should do mostly the same by
copying the line pointer into a uint32, turning off the lp_flags, and
summing the modified copy.

This patch is also skipping pd_special and the unused area of the page.

I'm still testing this; please beware that this likely has an even
higher bug density than my regular patches (and some debugging printouts
as well).

While reading the pg_filedump code I noticed that there's a way to tell
the different index pages apart, so perhaps we can use that to be able
to checksum the special space as well.

--
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

Attachment

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [GENERAL] db_user_namespace, md5 and changing passwords
Next
From: Josh Berkus
Date:
Subject: Re: Simple postgresql.conf wizard