Re: PostgreSQL 18.6/17.11: standby PANIC on restart after VM truncation

From: shihao zhong <zhong950419(at)gmail(dot)com>
To: rahul(at)rhyadav(dot)dev
Cc: Kirill Reshke <reshkekirill(at)gmail(dot)com>, Nktpro <nktpro(at)gmail(dot)com>, Pgsql Bugs <pgsql-bugs(at)lists(dot)postgresql(dot)org>, Melanie Plageman <melanieplageman(at)gmail(dot)com>
Subject: Re: PostgreSQL 18.6/17.11: standby PANIC on restart after VM truncation
Date: 2026-10-02 05:15:50
Message-ID: CAGRkXqSZXoazu1x48pz2SuW_xHYQDdRcbp2HNCfRNm_WLF8aYA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi Rahul,

On Thu, Oct 1, 2026, rahul(at)rhyadav(dot)dev wrote:
> However, with wal_consistency_checking = all on the primary, the
> patched standby still fails to restart:

I can reproduce this on master, and your change fixes it. It matches
heap_xlog_prune_freeze(), and vm_readbuf() on the primary.

No posted version of the fix applies to master on its own, so here
is one as v3. I will add a CommitFest entry so this does not get lost
before the November releases.

0001 is Melanie's v2-0002 from [1]. The changed lines and the commit
message are hers, only the context is adjusted for master. I left out
her v2-0001 and v2-0003, this report does not need them.

0002 is your diff. It had no commit message, so I put one together
from your mail. Please correct it if it is wrong.

0003 is my test. It now sets wal_consistency_checking = all, and it
takes a row lock first. Without the lock, the VM_NEW read in
heap_xlog_update() is not covered once 0002 is in.

The test fails without 0001. It also fails if any one of the three
RBM_ZERO_ON_ERROR or the three PageInit() calls is removed. That
holds on master, 19, 18 and 17. The nocfbot files hold the same three
patches for the back branches.

Melanie, if you would rather handle this in your thread, tell me and
I will close the entry.

[1]
https://postgr.es/m/CAAKRu_bApoksLDb-HX0GYciU3uLWqA1JagntaV8GP0%3D%2BidehHw%40mail.gmail.com

Thanks,
Shihao

Attachment Content-Type Size
nocfbot-v3-REL_18_STABLE.patch application/octet-stream 10.3 KB
nocfbot-v3-REL_19_STABLE.patch application/octet-stream 10.3 KB
nocfbot-v3-REL_17_STABLE.patch application/octet-stream 10.3 KB
v3-0002-Initialize-zeroed-VM-pages-in-VM-clear-redo.patch application/octet-stream 2.4 KB
v3-0001-Read-visibility-map-pages-with-RBM_ZERO_ON_ERROR-.patch application/octet-stream 3.4 KB
v3-0003-Add-test-for-standby-restart-after-VM-truncation.patch application/octet-stream 4.7 KB

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message rahul 2026-10-02 07:00:13 Re: PostgreSQL 18.6/17.11: standby PANIC on restart after VM truncation
Previous Message Michael Paquier 2026-10-02 04:32:20 Re: BUG #19730: PostgreSQL `pg_backup_start` accepts newlines in the backup label, producing an unrestorable `backup