Re: Deadlock detector fails to activate on a hot standby replica

From: Vitaly Davydov <v(dot)davydov(at)postgrespro(dot)ru>
To: Xuneng Zhou <xunengzhou(at)gmail(dot)com>, JoongHyuk Shin <sjh910805(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org, Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Subject: Re: Deadlock detector fails to activate on a hot standby replica
Date: 2026-08-05 08:10:34
Message-ID: 52971629-dcda-4687-90c8-bbba3ce05636@postgrespro.ru
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dear Xuneng Zhou, All

I've updated the patch for the master branch taking into account Xuneng Zhou's
review notes. Please, take a look.

Key notes are:

1. Renamed BufferIsReadyForCleanup to PinCountWaiterCheckReadyForCleanup and
removed some asserts just after LockBufHdr to avoid stalling of other processes
accessing this buffer if assert is activated. I'm not sure what are the adopted
rules for asserts - should we avoid indefinite locks or other issues due to
assert activation in general?

2. Removed elog(ERROR) from RegisterPinCountWaiter. I kept the asserts
unchanged but I'm not sure about it.

3. Fixed the issue with fast path in ResolveRecoveryConflictWithBufferPin. I
reused got_standby_delay_timeout variable in fast path when current time is
greater than ltime. There is no need to check this condition every time in
the for() loop. Checking the condition once and set got_standby_delay_timeout
is enough.

With best regards,
Vitaly
vitcpp(at)mail(dot)ru (aka v(dot)davydov(at)postgrespro(dot)ru)

Attachment Content-Type Size
v7-0001-Fix-recovery-conflict-wait-loop-for-buffer-pins-o.patch text/x-patch 8.7 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2026-08-05 08:15:18 Re: Fix a host of strto*() bugs
Previous Message Damil Shahzad 2026-08-05 08:09:09 Re: Fix var_eq_const: sum selectivity of all matching MCV entries instead of stopping at first match