pgsql: pg_combinebackup: Refuse mixed data checksum states in a backup

From: Daniel Gustafsson <dgustafsson(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: pg_combinebackup: Refuse mixed data checksum states in a backup
Date: 2026-09-14 13:34:14
Message-ID: E1x66p4-00000000I6N-2WVn@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

pg_combinebackup: Refuse mixed data checksum states in a backup chain

check_control_files() detected a chain whose backups were taken under
different data checksum states, warned, and proceeded. The output
directory keeps the last backup's control file, so a full backup taken
with checksums off combined with an incremental taken after an offline
enable produces a cluster whose control file says "on" while most of
its blocks carry no checksums; it starts, and then every connection
dies on the first unchecksummed catalog page. An offline enable
between two backups of a chain is all it takes, since it rewrites
every page without logging anything, so the incremental backup does
not re-ship the pages.

Turn the warning into an error, matching what pg_rewind does for the
equivalent combinations. The check stays asymmetric on purpose: when
the last backup was taken with checksums off, stale checksums from an
earlier backup are never verified, and that chain remains usable.

Author: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
Reviewed-by: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
Reviewed-by: Daniel Gustafsson <daniel(at)yesql(dot)se>
Discussion: https://postgr.es/m/anwm6UPxoVS41QA2@bdtpg
Backpatch-through: 19

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/724477d67e2307fbaea3452e8b78b87572f2ea02

Modified Files
--------------
doc/src/sgml/ref/pg_combinebackup.sgml | 19 +--
src/bin/pg_combinebackup/pg_combinebackup.c | 14 +-
src/test/modules/test_checksums/meson.build | 1 +
.../test_checksums/t/024_combinebackup_mixed.pl | 146 +++++++++++++++++++++
4 files changed, 167 insertions(+), 13 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Nathan Bossart 2026-09-14 14:16:41 pgsql: Describe special values in more GUC descriptions.
Previous Message Alexander Korotkov 2026-09-14 11:50:05 pgsql: Fix timeout overflow in WAIT FOR LSN