Re: Offline data checksum changes can cause incorrect checksum state on standbys

Started by Joao Rito11 days ago2 messageshackers
Jump to latest
#1Joao Rito
joaovictor.rito@gmail.com

Hi Raja,

Thanks for the patch. I tried v1 (cfbot branch cf/7587, commit
8dda72e) on Ubuntu 26.04 (WSL2), applied on master c1694b7. It applied
cleanly with git apply and pg_combinebackup rebuilt fine. The build
was --without-icu and without TAP tests.

I used a small script (attached as repro.sh) with initdb
--no-data-checksums, summarize_wal=on, a full backup, pg_checksums
--enable on the stopped cluster, then an incremental backup and
pg_combinebackup.

Before (master):
pg_combinebackup: error: only some backups have checksums enabled
pg_combinebackup: hint: Take a new full backup after changing the
data checksum state with pg_checksums.
(exit=1)

After (v1):
pg_combinebackup: error: only some backups have checksums enabled
pg_combinebackup: hint: Take a new full backup after changing the
data checksum state.
(exit=1)

I got the same before/after result for the online case. There I took a
full backup with checksums off, ran pg_enable_data_checksums(), waited
for data_checksums=on, took an incremental backup, and ran
pg_combinebackup. The full backup's control file shows
data_checksum_version 0 and the incremental shows 1.

Observations:
- The new hint matches the behaviour, since the check also triggers
after online enabling and the old hint pointed only at pg_checksums.
- The hint is now less actionable. A reader gets the "what" (take a
new full backup) but not how the state changed. That seems fine to me,
but you could keep it explicit, for example "after enabling or
disabling data checksums". I did not test a backup chain across a
disable.
- The doc xref checksums-online-enable-disable exists in wal.sgml. I
could not build the docs here (xmllint is missing), so the SGML change
is only read, not rendered.
- The new doc text says the chain is refused for backups taken "while
they were still being enabled". I did not test that intermediate
state, so I cannot confirm that sentence from a run.
- I did not run the pg_combinebackup TAP tests (IPC::Run not
available), and a grep for "data checksum state" in
src/bin/pg_combinebackup/t finds no test for this hint, so a small
test for the error/hint might be worth adding.
- src/bin/pg_combinebackup/po exists, so the translations may need an
update; I did not check the .po files.

Thanks again,
João Rito

Attachments:

repro.shapplication/octet-stream; name=repro.shDownload
#2shihao zhong
zhong950419@gmail.com
In reply to: Joao Rito (#1)

Hi Raja,

Thanks for the patch, the new hint looks good to me.

One more thing. An incremental backup taken while checksums are still
being enabled online also gets refused, though the restored cluster
just comes up with checksums off. The comment in check_control_files()
says we only check when the last backup has checksums on, so I think
the test should be "== PG_DATA_CHECKSUM_VERSION" instead of "!= OFF".

Thanks,
Shihao