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

From: Xuneng Zhou <xunengzhou(at)gmail(dot)com>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: Vitaly Davydov <v(dot)davydov(at)postgrespro(dot)ru>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Deadlock detector fails to activate on a hot standby replica
Date: 2026-06-25 13:36:17
Message-ID: CABPTF7V2wgjqN6g99uxR_RjGYCLo07e8ogWWTyAqMfzAGg5j_g@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Fujii-san, Vitaly,

On Thu, Jun 25, 2026 at 8:14 PM Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
>
> On Thu, Jun 25, 2026 at 12:16 AM Vitaly Davydov
> <v(dot)davydov(at)postgrespro(dot)ru> wrote:
> >
> > Dear Fujii Masao
> >
> > I've prepared patches of v6 for other majors. I hope, it will help.

Thanks for working on this. I haven't looked into the patch in detail
yet. The overall direction seems good to me. Here are two comments on
the first look:

1) It looks that this patch is doing some refactoring around
LockBufferForCleanup. The part being touched seems flaky itself on
HEAD, should we fix the issue in the buffer side first? [1]

> Thanks for the patches for the stable branches!
>
> I noticed that you added "buf_state &= ~BM_PIN_COUNT_WAITER;" to
> BufferIsReadyForCleanup(). Could you tell me why that's necessary? My
> understanding was that LockBufferForCleanup() is responsible for
> clearing that flag, so I didn't think it was needed here.
>
> But if it is necessary, I'd like to make the same change in master as
> well, to keep the code as consistent as possible between master and
> the stable branches.

2) buf_state &= ~BM_PIN_COUNT_WAITER in stable versions seems not
necessary to me as LockBufferForCleanup will handle the clearing for
us.

[1] https://www.postgresql.org/message-id/flat/7685519a-0bf9-4e17-93ca-7e3aa10fa29c%40gmail.com

--
Regards,
Xuneng Zhou
HighGo Software Co., Ltd.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Sebastiaan Mannem 2026-06-25 13:43:32 Re: Out-of-Cycle release? (was Re: BUG #19490: Streaming standby on 16.14 stops applying WAL on MultiXactOffsetSLRU when primary is 16.8)
Previous Message Arne Roland 2026-06-25 13:35:00 Re: Key joins