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

From: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
To: Daniel Gustafsson <daniel(at)yesql(dot)se>
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-14 05:47:06
Message-ID: an6r2vI39Hg/6+k1@bdtpg
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Thu, Aug 13, 2026 at 12:17:16PM +0200, Daniel Gustafsson wrote:
> > On 12 Aug 2026, at 02:29, Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
> >
> > On Tue, Aug 11, 2026 at 11:56 PM Daniel Gustafsson <daniel(at)yesql(dot)se> wrote:
> >> I'm leaning towards using an integer representation in v19, which is the safe
> >> option, and rethink it for v20 when we can consider it without any rush. A
> >> compromise could be do document the integer <=> state name mapping in the
> >> checksums section in the docs.
> >
> > +1 to keep using "version" for now and clarify the mapping in the docs.
>
> I took a stab at fixing this today and in doing so I realized another issue
> which isn't directly related to online checksums but also affect the offline
> checksums available in all supported versions. pg_control_init is documented
> to return the state at cluster initialization, but the checksum version in the
> controlfile is overwritten when changed, and the original value is lost. The
> attached 0001 fixes this by adding a new field to the controlfile. I think
> this should be backpatched to 19, but it could also be argued against that at
> this point in the cycle since it's a pre-existing regression (especially since
> it updates the controlfile format).
>
> The 0002 use data_page_checksum_version consistently, adds a mapping table to
> the documentation and fixes the tests.

Thanks for the updates!

I've a few comments:

=== 1

+# Regardless of the new state, pg_control_init() should still report checksums
+# as off.

Could we also test the opposite case and ensure pg_control_init() still reports 1?
Also, as 0001 fixes the offline case too, worth checking pg_checksums leaves the value
reported by pg_control_init() unchanged?

And should this test be part of 0001 instead of 0002?

=== 2

+ version using an integer representation due to how they were originally
+ implementated.

s/implementated/implemented/

Regards,

--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message shveta malik 2026-08-14 05:58:50 Re: Support EXCEPT for TABLES IN SCHEMA publications
Previous Message Japin Li 2026-08-14 05:46:41 Reduce padding in WALOpenSegment and XLogReaderState