Re: Set 1s WaitLatch timeout if standby limit has expired in ResolveRecoveryConflictWithBufferPin

From: shihao zhong <zhong950419(at)gmail(dot)com>
To: Dmytro Astapov <dastapov(at)gmail(dot)com>
Cc: Anthony Hsu <erwaman(at)gmail(dot)com>, Álvaro Herrera <alvherre(at)kurilemu(dot)de>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Set 1s WaitLatch timeout if standby limit has expired in ResolveRecoveryConflictWithBufferPin
Date: 2026-10-02 05:37:39
Message-ID: CAGRkXqSn-PU-KwU6GwwhhJxZ8yyjioRf-kxzR0UrS5y_Hbk3yA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

I reviewed v2. The bug is real on master and v2 fixes it. With
Dmytro's steps, master never cancels the cursor session. With v2 it
gets FATAL about one second after it takes the pin.

I had a few small comments, so I just made the changes. v3 is
attached.

- It calls WaitLatch directly in standby.c, so proc.c and proc.h are
not touched. That should be easier to backpatch.
- The comment no longer names PROCSIG_RECOVERY_CONFLICT_BUFFERPIN,
which is gone since 17f51ea8187.
- The 1s is a define now, and the commit message is shorter.

The patch in [1] rewrites the same wait as a loop, so the two do not
apply together. Its expired path still sleeps with no timeout, so
this fix is still needed after it.

[1]
https://www.postgresql.org/message-id/flat/44c24dcf-5710-410f-b1b6-d10b315f3d51(at)postgrespro(dot)ru

Regards,
Shihao

Attachment Content-Type Size
v3-0001-Set-1s-WaitLatch-timeout-if-standby-limit-has-exp.patch application/octet-stream 2.9 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2026-10-02 05:48:55 Re: pg_dump: ALTER INDEX SET STATISTICS missing for index-backed constraints
Previous Message shihao zhong 2026-10-02 05:30:07 Re: Throwing away unnecessary spin-locks