Re: Deadlock detector fails to activate on a hot standby replica - Mailing list pgsql-hackers

From Vitaly Davydov
Subject Re: Deadlock detector fails to activate on a hot standby replica
Date
Msg-id 16cdffd4-f06c-4957-9132-1849a719f3d4@postgrespro.ru
Whole thread
In response to Re: Deadlock detector fails to activate on a hot standby replica  (Fujii Masao <masao.fujii@gmail.com>)
List pgsql-hackers
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?

With best regards,
Vitaly



pgsql-hackers by date:

Previous
From: Melanie Plageman
Date:
Subject: Re: 048_vacuum_horizon_floor.pl hangs due to wakeup lost inside LockBufferForCleanup
Next
From: Zsolt Parragi
Date:
Subject: Re: [PATCH v3] Add ssl_cert_files/ssl_key_files for multi-certificate support