Standby writes pages past minRecoveryPoint after crash recovery

From: shihao zhong <zhong950419(at)gmail(dot)com>
To: pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Jan Nidzwetzki <jan(at)planetscale(dot)com>, Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
Subject: Standby writes pages past minRecoveryPoint after crash recovery
Date: 2026-12-03 04:09:16
Message-ID: CAGRkXqQMo6LH+hFwkDoFEZV-BRLs1NOj_XV2O-Cdqf1YAxvnpA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi hackers,

While reviewing Jan's patch [1], I found that a standby can write pages
newer than its minRecoveryPoint.

A crashed primary restarted with standby.signal starts with an invalid
minRecoveryPoint. If the checkpointer sees that during crash recovery,
it clears updateMinRecoveryPoint for good. After the switch to archive
recovery, its restartpoints no longer move minRecoveryPoint. This can
happen since 7ff23c6d277.

The attached patch clears the flag only in the startup process, and
adds a TAP test.

[1] https://postgr.es/m/0491e46f-a1c3-48db-b171-705ca95c8263@planetscale.com

Thanks,
Shihao

Attachment Content-Type Size
v1-0001-Keep-advancing-minRecoveryPoint-after-crash-recov.patch application/octet-stream 5.9 KB

Browse pgsql-hackers by date

  From Date Subject
Previous Message shihao zhong 2026-12-03 03:55:23 Re: DROP USER MAPPING doesn't acquire lock on its server