Re: Standby writes pages past minRecoveryPoint after crash recovery

From: Jan Nidzwetzki <jan(at)planetscale(dot)com>
To: shihao zhong <zhong950419(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
Subject: Re: Standby writes pages past minRecoveryPoint after crash recovery
Date: 2026-12-03 15:36:56
Message-ID: 5b4f9fe8-d438-431d-bf2f-793819ad100f@planetscale.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Shihao,

Thanks for working on this. I can reproduce it, and your patch fixes it.

On 03.12.26 05:09, shihao zhong wrote:
> Hi hackers,
>
> While reviewing Jan's patch [1], I found that a standby can write pages
> newer than its minRecoveryPoint.
> [...]
> The attached patch clears the flag only in the startup process, and
> adds a TAP test.

The two patches work together without any conflicts. Each test fails
only if its own fix is missing, and both the recovery and pg_rewind
suites pass when both patches are applied.

However, in one case my patch [1] relies on yours. When a crashed
primary is restarted as a standby, the checkpointer can clear
updateMinRecoveryPoint during crash recovery. This means the
UpdateMinRecoveryPoint() call added by my patch at the shutdown
restartpoint has no effect in that situation. I tested this setup, and
the node is only rewound when both patches are present.

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

Best regards
Jan

--
Jan Nidzwetzki
PlanetScale

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Corey Huinker 2026-12-03 15:47:28 Re: postgres_fdw can crash on malformed remote results
Previous Message Greg Burd 2026-12-03 15:36:09 Re: Interrupts vs signals