| From: | Raja Sai pranav <rajasaipranav0(at)gmail(dot)com> |
|---|---|
| To: | shihao zhong <zhong950419(at)gmail(dot)com> |
| Cc: | João Rito <joaovictor(dot)rito(at)gmail(dot)com>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Offline data checksum changes can cause incorrect checksum state on standbys |
| Date: | 2026-11-22 16:17:23 |
| Message-ID: | CAPHduZCggKw=PvqD_RLdrp-PkjyBzuqqhoGewmZjGNsO1mcOdw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Sun, Nov 22, 2026 at 12:35 AM shihao zhong <zhong950419(at)gmail(dot)com> wrote:
> 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, you're right. I tested it with an incremental backup taken while
the state was inprogress-on. With your change pg_combinebackup accepts the
chain, and the restored cluster logs "enabling data checksums was
interrupted" and comes up with checksums off, with all rows readable.
I also checked the other way recovery can end. When the archive has WAL
past the point where enabling finished, recovery replays the rest of it and
the restored cluster ends with checksums on. pg_checksums --check then
finds no bad blocks, because the worker writes every page with a full-page
image.
The same change also accepts a final backup taken while checksums were
being disabled, which is safe for the same reason.
v2 attached:
0001 is v1 unchanged (hint and docs).
0002 makes your change, adds a sentence to the docs, and adds a case to
test_checksums/024_combinebackup_mixed.pl for a final backup taken during
an online enable. The new case fails without the code change. While running
it I hit a race: the first restored node in that test can archive a
timeline 2 history file into the shared archive, and the second restored
node then tries to follow a timeline that branched before its backup. The
new node now sets recovery_target_timeline = 'current'.
I credited you with Suggested-by in 0002.
Regards,
Sai Pranav
| Attachment | Content-Type | Size |
|---|---|---|
| v2-0001-pg_combinebackup-Don-t-point-only-to-pg_checksums.patch | application/octet-stream | 3.1 KB |
| v2-0002-pg_combinebackup-Accept-a-final-backup-taken-duri.patch | application/octet-stream | 5.4 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Greg Burd | 2026-11-22 16:35:34 | Re: Let an ordering index scan hand its ORDER BY value to the target list |
| Previous Message | Matias Kenig | 2026-11-22 16:11:50 | Proposal: ABSENT ON TRAILING NULL for JSON_ARRAY |