Re: BUG #19775: Incremental backup without data checksums restores a stale visibility map page after VACUUM truncati

From: shihao zhong <zhong950419(at)gmail(dot)com>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: kehan5800(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19775: Incremental backup without data checksums restores a stale visibility map page after VACUUM truncati
Date: 2026-10-23 03:01:05
Message-ID: CAGRkXqT78UKggte9NPd=A12w_FAB=Bu8V=h12wGK1G2TJBbB7w@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi Fujii-san,

Thanks for the patch. I reported this on pgsql-hackers a day after
Ke [1]. I fixed it on the WAL writer side instead. My patch always
WAL-logs the VM page in visibilitymap_prepare_truncate(), as Andres
suggested in [2]. I tested both fixes.

1. Writer side vs summarizer side. The writer side fix gives the VM
page a new LSN and a WAL block reference. So any tool that reads WAL
or page LSNs may sees it, not only the summarizer. For example, WAL-G
delta backups track page LSNs. I think they may miss the page with a
summarizer only fix, but I have not tested them. The cost is a page
image when checksums and wal_log_hints are off. It also misses WAL
written before the update but not yet in a summary file, and an
updated standby with an old primary. Yours covers both and adds no
WAL. So yours fits the back branches better. Whether the master should
WAL-log the page is your call.

2. On 17 and 18, 013 passes even without the fix. The attached patch
reads the VM with pg_visibility_map() per block, so it fails there
too.

3. A correction to [1]. A later VACUUM does not fix the wrong results

[1]
https://postgr.es/m/CAGRkXqSnghF+wbyP-PdfjVLfbejJG3cvZd9hN-gxsvCWj2F64Q@mail.gmail.com
[2]
https://postgr.es/m/t7xd6gjxdxpzdzr2uamfbyi5rlkdsikiywmtmgwrwcsr77xyw7@i3qhbzy5rpzx

Thanks,
Shihao

Attachment Content-Type Size
0001-Read-VM-bits-past-the-heap-end-in-013_vm_truncation.patch application/octet-stream 1.3 KB

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Hayato Kuroda (Fujitsu) 2026-10-23 03:24:43 RE: START_REPLICATION silently truncates an overlong LSN component
Previous Message shihao zhong 2026-10-23 02:32:47 Re: BUG #19784: "no relation entry for relid 1" when costing = ANY (<array expr over max(col)>) in a MinMaxAggPath