Re: Problem with synchronous replication

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: "lingce(dot)ldm" <lingce(dot)ldm(at)alibaba-inc(dot)com>, Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Problem with synchronous replication
Date: 2019-10-30 13:00:12
Message-ID: 20191030130012.GD20808@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Antonin Houska 2019-10-30 13:44:18 MarkBufferDirtyHint() and LSN update
Previous Message Peter Eisentraut 2019-10-30 12:02:07 Re: Unix-domain socket support on Windows