Re: More tests to stress directly checksum_impl.h

From: David Steele <david(at)pgmasters(dot)net>
To: Michael Paquier <michael(at)paquier(dot)xyz>, Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: More tests to stress directly checksum_impl.h
Date: 2020-03-06 14:48:50
Message-ID: 4427fccf-735f-b08a-e355-807aefc18fd9@pgmasters.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 3/6/20 2:52 AM, Michael Paquier wrote:
>
> As of the thread which led to addd034 (please see
> https://www.postgresql.org/message-id/E1j9ioh-0005Kn-4O@gemulon.postgresql.org,
> and sorry about that), it happens that we don't have any tests which
> validate the internal data checksum implementation present in core as
> of checksum_impl.h. pageinspect includes a SQL-callable function to
> calculate the checksum of a page, mentioned by David in CC, and only
> one test exists to make sure that a checksum is not NULL, but it does
> not really help if the formula is touched.
>
> Attached is a patch to close the gap by adding new tests to
> pageinspect aimed at detecting any formula change. The trick is to
> make the page data representative enough so as it is possible to
> detect problems if any part of the formulas are changed, like updates
> of pg_checksum_block or checksumBaseOffsets.
>
> Any thoughts or other ideas?

This looks sensible to me. The only downside is that it needs to be in
a contrib test rather than in the core tests, but it is far better than
nothing.

I'll be interested to see what the build farm thinks of it. Since we
treat the page as an array of uint32_t while checksumming it seems that
endianness will be a factor in the checksum. My guess is that the first
three tests (01, 04, FF) will work on any endianness and the last three
tests will not.

regards,
--
-David
david(at)pgmasters(dot)net

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2020-03-06 14:49:17 Re: Index Skip Scan
Previous Message Laurenz Albe 2020-03-06 14:45:50 Re: Berserk Autovacuum (let's save next Mandrill)