| From: | surya poondla <suryapoondla4(at)gmail(dot)com> |
|---|---|
| To: | shihao zhong <zhong950419(at)gmail(dot)com> |
| Cc: | Michael Paquier <michael(at)paquier(dot)xyz>, Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>, jan(at)planetscale(dot)com |
| Subject: | Re: Standby writes pages past minRecoveryPoint after crash recovery |
| Date: | 2026-12-04 23:26:08 |
| Message-ID: | CAOVWO5pyv2=QVR_MN1bXu8mcOo5jWSQ8EMcWhqVDYpb__DxrjA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi Shihao,
I tested v2 on master (cassert build) by restarting a crashed primary as a
standby of its promoted standby, counting the DEBUG2 "updated min recovery
point" messages per process after "entering archive recovery", and scanning
the page LSNs on disk after an immediate stop.
Without the fix, the checkpointer never advances minRecoveryPoint after the
switch, whether the restartpoints during crash recovery were skipped or
real.
With v2 the checkpointer kept advancing minRecoveryPoint after the switch
with 9 updates during the restartpoints in that run, and 13 in a second run
(2 during its one real restartpoint, 11 from the forced update on skipped
restartpoints), against 0 on master in both runs. The scan of pages on disk
was clean.
The bgwriter has the same problem with a tiny shared_buffers and no
restartpoints, master's bgwriter made 0 updates after the switch, v2's
made 25. v2 fixes it too, but the commit message and the test only mention
the checkpointer, so it might be worth saying the fix covers any process
other than the startup process.
Regarding Fujii's ordering question, the new 016 test failed 5/5 with the
server change reverted and passed 3/3 with it, so in practice it catches
the bug, even if the ordering isn't guaranteed.
The full recovery and pg_rewind suites pass. Starting the crashed primary
with recovery.signal behaves the same with and without the patch.
The bug goes back to 7ff23c6d277, so it needs back-patching to 15. v2
applies cleanly to REL_19_STABLE; 15–18 only need XLogRecPtrIsValid()
changed to !XLogRecPtrIsInvalid().
Overall v2 looks good to me.
Regards,
Surya Poondla
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Manu | 2026-12-05 00:20:02 | Re: Allow progress tracking of sub-commands |
| Previous Message | Tatsuo Ishii | 2026-12-04 22:58:12 | Re: Row pattern recognition |