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 <[email protected]>
Reviewed-by: Bertrand Drouvot <[email protected]>
Reviewed-by: Daniel Gustafsson <[email protected]>
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(-)

Reply via email to