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

From: Raja Sai pranav <rajasaipranav0(at)gmail(dot)com>
To: daniel(at)yesql(dot)se
Cc: zsolt(dot)parragi(at)percona(dot)com, bertranddrouvot(dot)pg(at)gmail(dot)com, hlinnaka(at)iki(dot)fi, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Re: Offline data checksum changes can cause incorrect checksum state on standbys
Date: 2026-11-03 15:17:41
Message-ID: CAPHduZAYhrjsEBz73HuQBP87+61LnxHo6aCyi5_2-PnV9LiAug@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Daniel,

A small follow-up to 724477d67e2 (pg_combinebackup: Refuse mixed data
checksum states in a backup chain).

The refusal also fires when checksums were enabled online, and then the
hint points to a tool the user never ran:

initdb --no-data-checksums, summarize_wal = on
full backup
SELECT pg_enable_data_checksums(); -- wait for "on"
incremental backup
pg_combinebackup full incr

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.

The same happens for a full backup taken while checksums were still being
enabled (its control file has data checksum version 3) followed by an
incremental taken after they reached "on".

The attached patch drops "with pg_checksums" from the hint, and changes the
Limitations paragraph in the pg_combinebackup docs to cover both ways of
enabling checksums and the in-progress case. pg_combinebackup's tests and
test_checksums' 024_combinebackup_mixed (PG_TEST_EXTRA=checksum) pass, and
the docs validate.

One related observation, not addressed by the patch: after an online enable
the refusal is stricter than it needs to be. The worker writes every page
with log_newpage_buffer(), so the WAL summaries cover every block, and in
my test the incremental backup taken afterwards contained no INCREMENTAL
files at all: every relation file was sent in full, so nothing in the
combined directory would have come from the backup taken before checksums
were on. I don't think pg_combinebackup can tell an online enable from an
offline one with what is in the control files, so refusing both seems like
the safe choice; I mention it only in case the docs should say so.

Regards,
Sai Pranav

On Tue, Nov 03, 2026 08:46 PM, Daniel Gustafsson <daniel(at)yesql(dot)se> wrote:

> Pushed to master along with the cleanups from the "Trying to break online
> checksums with LLMs" thread. Not backpatched yet, as I wanted a few
> builds in
> the BF first and also some input on the new open item in the other thread.
>
> --
> Daniel Gustafsson
>
>
>
>
>
>

Attachment Content-Type Size
v1-0001-pg_combinebackup-Don-t-point-only-to-pg_checksums.patch text/x-patch 3.1 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2026-11-03 15:31:43 Re: pg_plan_advice fails on a CustomScan that replaces a join
Previous Message Kirill Reshke 2026-11-03 15:12:17 Re: Make Append subplans async capable in more cases