| From: | Heikki Linnakangas <hlinnaka(at)iki(dot)fi> |
|---|---|
| To: | Álvaro Herrera <alvherre(at)kurilemu(dot)de>, Anthony Hsu <erwaman(at)gmail(dot)com> |
| Cc: | Xuneng Zhou <xunengzhou(at)gmail(dot)com>, João Rito <joaovictor(dot)rito(at)gmail(dot)com>, shihao zhong <zhong950419(at)gmail(dot)com>, Andrey Borodin <x4mmm(at)yandex-team(dot)ru>, Dmytro Astapov <dastapov(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org, Fujii Masao <masao(dot)fujii(at)gmail(dot)com> |
| Subject: | Re: Set 1s WaitLatch timeout if standby limit has expired in ResolveRecoveryConflictWithBufferPin |
| Date: | 2026-11-27 19:32:02 |
| Message-ID: | e0553e28-d4c7-4883-8e92-f6ee30f7ded7@iki.fi |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On 27/11/2026 12:34, Álvaro Herrera wrote:
> One thing I'm not really in love with is to have the WaitLatch/
> ResetLatch dance directly in ResolveRecoveryConflictWithBufferPin(),
> when previously it was neatly encapsulated in ProcWaitForSignal(). I
> think (for master only) we should consider adding a timeout parameter to
> ProcWaitForSignal(), which would I think make this code a tiny bit neater.
I looked at this more closely because it conflicted with my "Interrupts
vs signals" work. I don't see anything wrong, but I started to wonder
why we use the SIGALRM based timers for the standby timeouts, when we're
just sleeping on WaitLatch(). WaitLatch() takes a timeout argument, why
don't we just use that? Would seem much more straightforward.
Punching through the encapsulation of ProcWaitForSignal() doesn't really
bother me, and in fact with my "Interrupts vs signals" rewrite, the
ProcSendSignal() and ProcWaitForSignal() functions are gone anyway,
replaced by interrupts. But yeah, you could add a timeout argument to
ProcWaitForSignal() instead if you'd prefer.
So, what do you think of the attached? (for master only)
One side-effect of this is that this no longer calls
disable_all_timeouts(). Another minor issue related to that is being
discussed at
https://www.postgresql.org/message-id/CAHGQGwFJixYTymPZ6dwOO-G0VdjO1AgZTma6CtJgc0Ptxfz3BA@mail.gmail.com.
We should fix that separately, this isn't enough to fix that issue, nor
does it make it worse, but I thought I'd mention it.
- Heikki
| Attachment | Content-Type | Size |
|---|---|---|
| v1-0001-Use-WaitLatch-for-the-timeouts-in-recovery-confli.patch | text/x-patch | 16.6 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Heikki Linnakangas | 2026-11-27 19:44:03 | Re: Should we skip foreign key checks in binary upgrade mode? |
| Previous Message | Jan Nidzwetzki | 2026-11-27 19:23:01 | pg_rewind --source-pgdata ignores minRecoveryPoint of a stopped standby |