Re: pg_control_checkpoint(): add "data_checksum_version" (Pg19)?

From: Daniel Gustafsson <daniel(at)yesql(dot)se>
To: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
Cc: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, Ian Lawrence Barwick <barwick(at)gmail(dot)com>, PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: pg_control_checkpoint(): add "data_checksum_version" (Pg19)?
Date: 2026-08-18 08:41:51
Message-ID: 3357CC02-06DD-494B-8BA9-F48956093C6F@yesql.se
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On 18 Aug 2026, at 06:55, Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com> wrote:

Thanks for reviewing!

> +# Make sure pg_control_init reports the initial disabled state
> +$result = $node->safe_psql('postgres',
> + 'SELECT data_page_checksum_version FROM pg_control_init();');
> +is($result, '0', 'ensure pg_control_init reports disabled state');
>
> This is done before the checksum state changes, when both the initial and current
> states are off. So it does not verify that pg_control_init() preserves the initial
> value after a state change.

Correct, the intention was to test the initial state.

> Worth to move it (or add one) here?
>
> "
> # Finish test suite by enabling checksums and make sure all data can be read
> # back and no processes are left over
> enable_data_checksums($node, wait => 'on');

Added a new test here to make it's still reported per the initdb state.

> Also worth checking in 004_offline.pl after,
>
> "
> # Enable checksums offline using pg_checksums
> $node->stop;
> $node->checksum_enable_offline;
> $node->start;
> "
>
> that pg_control_init() still reports the initial disabled state? That would also
> verify for the pg_checksums case.

Added.

I also added another test for pg_control_checkpoint in 004_offline to test the
state before and after a CHECKPOINT from offline checksum enabling.

--
Daniel Gustafsson

Attachment Content-Type Size
v6-0001-Record-initial-state-of-data-checksums-in-control.patch application/octet-stream 8.4 KB
v6-0002-Add-data_page_checksum_version-to-pg_control_chec.patch application/octet-stream 9.5 KB
unknown_filename text/plain 1 byte

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message John Naylor 2026-08-18 08:53:25 Re: Optimize UUID parse using SIMD
Previous Message wenhui qiu 2026-08-18 08:39:53 Re: Reduce LEFT/FULL JOIN to ANTI JOIN in more cases