Re: bugfix: when the blocksize is 32k, the function page_header of pageinspect returns negative numbers.

From: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
To: Quan Zongliang <quanzongliang(at)yeah(dot)net>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: bugfix: when the blocksize is 32k, the function page_header of pageinspect returns negative numbers.
Date: 2021-07-08 03:42:26
Message-ID: CALj2ACVvmn7RsV9BmXLKv9M-7WZtabyyALECsY_iKbz4Cj1VtA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jul 8, 2021 at 6:26 AM Quan Zongliang <quanzongliang(at)yeah(dot)net> wrote:
>
> If the block size is 32k, the function page_header of the pageinspect
> module returns negative numbers:
>
> postgres=# select * from page_header(get_raw_page('t1',0));
> lsn | checksum | flags | lower | upper | special | pagesize |
> version | prune_xid
> -----------+----------+-------+-------+-------+---------+----------+---------+-----------
> 0/174CF58 | 0 | 0 | 28 | 32736 | -32768 | -32768 |
> 4 | 0
> (1 row)
>
>
> This patch changes the output parameters lower, upper, special and
> pagesize to int32.
>
> postgres=# select * from page_header(get_raw_page('t1',0));
> lsn | checksum | flags | lower | upper | special | pagesize |
> version | prune_xid
> -----------+----------+-------+-------+-------+---------+----------+---------+-----------
> 0/19EA640 | 0 | 0 | 28 | 32736 | 32768 | 32768 |
> 4 | 0
> (1 row)

+1. int32 makes sense because the maximum allowed block size is 32768
and smallint with range -32768 to +32767 can't hold it. Internally,
lower, upper, special are treated as unit16. I looked at the patch,
how about using "int4" instead of just "int", just for readability?
And, do we need to change in pageinspect--1.1--1.2.sql and
pageinspect--1.0--1.1.sql along with pageinspect--1.5.sql?

Regards,
Bharath Rupireddy.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message houzj.fnst@fujitsu.com 2021-07-08 03:46:42 RE: Added schema level support for publication.
Previous Message k.jamison@fujitsu.com 2021-07-08 03:27:55 RE: Transactions involving multiple postgres foreign servers, take 2