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 <[email protected]>
Reviewed-by: Bertrand Drouvot <[email protected]>
Discussion: https://postgr.es/m/[email protected]
Backpatch-through: 19

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/aaf8b9989f7aaeb6594122caee1eea6c87e10655

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(-)

Reply via email to