Re: Assert in pageinspect with NULL pages

From: Julien Rouhaud <rjuju123(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Daria Lepikhova <d(dot)lepikhova(at)postgrespro(dot)ru>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Assert in pageinspect with NULL pages
Date: 2022-02-17 09:40:41
Message-ID: 20220217094041.c2h5q63jlwdajsiy@jrouhaud
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Feb 17, 2022 at 05:57:49PM +0900, Michael Paquier wrote:
> On Thu, Feb 17, 2022 at 01:46:40PM +0500, Daria Lepikhova wrote:
> > INSERT INTO test1(y) SELECT 0 FROM generate_series(1,1E6) AS x;
> > SELECT page_checksum(repeat(E'\\000', 8192)::bytea, 1);
>
> Indeed. Good catch, and that seems pretty old at quick glance for the
> checksum part. I'll try to look at all that tomorrow.

Indeed, the problem in page_checksum() has been there since the beginning as
far as I can see.

About the patch, it's incorrectly using a hardcoded 8192 block-size rather than
using the computed :block_size (or computing one when it's not already the
case).

I'm also wondering if it wouldn't be better to return NULL rather than throwing
an error for uninitialized pages.

While at it, it could also be worthwhile to add tests for invalid blkno and
block size in page_checksum().

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2022-02-17 09:43:24 Re: Failed transaction statistics to measure the logical replication progress
Previous Message Amit Kapila 2022-02-17 09:08:19 Re: Failed transaction statistics to measure the logical replication progress