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

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Daniel Gustafsson <daniel(at)yesql(dot)se>
Cc: Bertrand Drouvot <bertranddrouvot(dot)pg(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-19 07:49:27
Message-ID: CAHGQGwHb4oRznFO0wigUhOusWjy5+Cu-cNAEEy-Gi3nJoCTy=w@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Aug 19, 2026 at 7:13 AM Daniel Gustafsson <daniel(at)yesql(dot)se> wrote:
>
> > On 18 Aug 2026, at 11:55, Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com> wrote:
>
> > I don't have more comments, LGTM.
>
> Thanks for review, pushed and backpatched.

Thanks for working on this!

+ /*
+ * Data checksum state at cluster initialization. Since the state can be
+ * changed during runtime, we need to store the initial value for system
+ * functions which report initdb settings.
+ */
+ uint32 data_checksum_version_init;

Do we really need to store this value in pg_control? I wonder how useful
it would be to users.

If data_checksum_version_init is needed only for
pg_control_init().data_page_checksum_version, I'm inclined to think
it isn't worth adding it to pg_control. In that case,
pg_control_init().data_page_checksum_version would also be of little use,
and I think it would be better to remove it rather than change
the meaning of its value.

Instead, how about removing pg_control_init().data_page_checksum_version,
adding a new function such as pg_control_state(), and having it return
the current data_checksum_version? Isn't that be simpler and less confusing?

This would also address two current inconsistencies:

- ControlFile->data_checksum_version is the only one of these values
not exposed by a SQL function.
- ControlFile->data_checksum_version_init is the only one not shown
by pg_controldata.

Thoughts?

Regards,

--
Fujii Masao

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message ZizhuanLiu X-MAN 2026-08-19 07:52:07 Re: Fix var_eq_const: sum selectivity of all matching MCV entries instead of stopping at first match
Previous Message Michael Paquier 2026-08-19 07:45:46 Re: [PATCH] Add tests for src/backend/nodes/extensible.c