Re: pg_control_checkpoint(): add "data_checksum_version" (Pg19)? - Mailing list pgsql-hackers

From Fujii Masao
Subject Re: pg_control_checkpoint(): add "data_checksum_version" (Pg19)?
Date
Msg-id CAHGQGwHb4oRznFO0wigUhOusWjy5+Cu-cNAEEy-Gi3nJoCTy=w@mail.gmail.com
Whole thread
In response to Re: pg_control_checkpoint(): add "data_checksum_version" (Pg19)?  (Daniel Gustafsson <daniel@yesql.se>)
Responses Re: hashjoins vs. Bloom filters (yet again)
List pgsql-hackers
On Wed, Aug 19, 2026 at 7:13 AM Daniel Gustafsson <daniel@yesql.se> wrote:
>
> > On 18 Aug 2026, at 11:55, Bertrand Drouvot <bertranddrouvot.pg@gmail.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



Attachment

pgsql-hackers by date:

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