Re: Problem with synchronous replication - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: Problem with synchronous replication
Date
Msg-id 20191030130012.GD20808@paquier.xyz
Whole thread Raw
In response to Re: Problem with synchronous replication  (Fujii Masao <masao.fujii@gmail.com>)
List pgsql-hackers
On Wed, Oct 30, 2019 at 05:21:17PM +0900, Fujii Masao wrote:
> This change causes every ending backends to always take the exclusive lock
> even when it's not in SyncRep queue. This may be problematic, for example,
> when terminating multiple backends at the same time? If yes,
> it might be better to check SHMQueueIsDetached() again after taking the lock.
> That is,
>
> if (!SHMQueueIsDetached(&(MyProc->syncRepLinks)))
> {
>     LWLockAcquire(SyncRepLock, LW_EXCLUSIVE);
>     if (!SHMQueueIsDetached(&(MyProc->syncRepLinks)))
>         SHMQueueDelete(&(MyProc->syncRepLinks));
>     LWLockRelease(SyncRepLock);
> }

Makes sense.  Thanks for the suggestion.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Unix-domain socket support on Windows
Next
From: Antonin Houska
Date:
Subject: MarkBufferDirtyHint() and LSN update