On Tue, Jun 23, 2026 at 3:32 AM Vitaly Davydov <[email protected]> wrote:
>
> Dear Fujii Masao, All
>
> While working on porting the patch to other majors, I've found that, the code
> in RegisterPinCountWaiter() (see below) should be improved because it doesn't
> unlock the bufHdr when the error is raised, as in LockBufferForCleanup().
> I guess it works, but it keeps the locks a bit longer.
>
> RegisterPinCountWaiter v5 patch code:
>      ...
>      if ((buf_state & BM_PIN_COUNT_WAITER) != 0 &&
>             bufHdr->wait_backend_pgprocno != MyProcNumber)
>             elog(ERROR, "multiple processes attempting to wait for pincount 
> 1");
>
> RegisterPinCountWaiter proposed changes:
>      ...
>      if ((buf_state & BM_PIN_COUNT_WAITER) != 0 &&
>             bufHdr->wait_backend_pgprocno != MyProcNumber)
>         {
>             UnlockBufHdr(bufHdr);
>             elog(ERROR, "multiple processes attempting to wait for pincount 
> 1");
>         }
>
> What do you think?

You're right. Thanks for pointing out that!

I've updated the patch accordingly.

Regards,

-- 
Fujii Masao

Attachment: v6-0001-Fix-deadlock-detector-activation-in-a-recovery-co.patch
Description: Binary data

Reply via email to