pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Daniel Gustafsson <dgustafsson@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Record initial state of data checksums in controlfile
Date: Tue, 18 Aug 2026 20:40:39 +0000
Message-ID: <E1wwQbu-000000016rL-2FiP@gemulon.postgresql.org> (raw)

Record initial state of data checksums in controlfile

The controlfile records the current state of data checksums, which
also used to be the initial state from initdb when checksums could
not be altered after initialization.  pg_control_init is documented
to return information about cluster initialization state, which it
no longer will if data checksums have been changed either using the
offline tool or with online processing.

Fix by adding a new field in the control file which tracks the init
value of data checksums, and is left read only after initialization.

While this is a regression dating back to when changing checksum
state was made possible offline with pg_checksums, it is a control
file change so it cannot be backpatched.

Backpatch to v19 where online checksums were introduced.

Author: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://postgr.es/m/B87ABFBE-A304-4839-8706-C80D73E6BF5C@yesql.se
Backpatch-through: 19

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/514fb08f51471b47c6d4e059df70be97f61a78cc

Modified Files
--------------
src/backend/access/transam/xlog.c                 |  1 +
src/backend/utils/misc/pg_controldata.c           |  2 +-
src/include/catalog/pg_control.h                  | 10 ++++++++--
src/test/modules/test_checksums/t/001_basic.pl    | 23 ++++++++++++++++-------
src/test/modules/test_checksums/t/002_restarts.pl | 12 +++++++++++-
src/test/modules/test_checksums/t/004_offline.pl  | 14 ++++++++++++--
6 files changed, 49 insertions(+), 13 deletions(-)



view thread (2+ messages)  latest in thread

Message-ID: <E1wwQbu-000000016rL-2FiP@gemulon.postgresql.org>
Permalink:  ../E1wwQbu-000000016rL-2FiP@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1wwQbu-000000016rL-2FiP@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: dgustafsson@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Record initial state of data checksums in controlfile
  In-Reply-To: <E1wwQbu-000000016rL-2FiP@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox