Re: pgsql: Avoid -Wconversion warnings when using checksum_impl.h

From: David Steele <david(at)pgmasters(dot)net>
To: Michael Paquier <michael(at)paquier(dot)xyz>, Magnus Hagander <magnus(at)hagander(dot)net>
Cc: pgsql-committers <pgsql-committers(at)lists(dot)postgresql(dot)org>
Subject: Re: pgsql: Avoid -Wconversion warnings when using checksum_impl.h
Date: 2020-03-06 00:58:50
Message-ID: e19fa62e-f140-306a-aa6b-fb55ccb3b9c1@pgmasters.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

On 3/5/20 7:48 PM, Michael Paquier wrote:
> On Thu, Mar 05, 2020 at 04:14:20PM -0800, Magnus Hagander wrote:
>> That's a pretty dangerous mistake, and moreso because we don't have a
>> test around it. We should really find a way to add such a test -- just
>> a hardcoded page calculation that should always return the same value
>> perhaps?
>
> Yes.. Using pg_checksums --check on an upgraded instance which had
> checksums enabled would detect that immediately, but it could be
> possible also to have a SQL-callable function which takes in input a
> bytea and returns the checksum. In order to make such tests reliable
> with any page size, we could pass down the page size to
> pg_checksum_page(), and then give the function's caller this
> possibility. However I recall that we'd rather keep BLCKSZ hardcoded
> in checksum_impl.h on performance grounds.

Yeah, keeping BLKSZ a constant is pretty important for performance.
That's one of the main reasons that we only support the default.

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

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2020-03-06 01:10:06 Re: pgsql: Avoid -Wconversion warnings when using checksum_impl.h
Previous Message Michael Paquier 2020-03-06 00:48:58 Re: pgsql: Avoid -Wconversion warnings when using checksum_impl.h