Re: Problem with synchronous replication

From: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
To: masao(dot)fujii(at)gmail(dot)com
Cc: lingce(dot)ldm(at)alibaba-inc(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Problem with synchronous replication
Date: 2019-10-30 08:43:04
Message-ID: 20191030.174304.523404903817205414.horikyota.ntt@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello.

At Wed, 30 Oct 2019 17:21:17 +0900, Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote in
> 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,

I'm not sure how much that harms but double-checked locking
(releasing) is simple enough for reducing possible congestion here, I
think. In short, + 1 for that.

> if (!SHMQueueIsDetached(&(MyProc->syncRepLinks)))
> {
> LWLockAcquire(SyncRepLock, LW_EXCLUSIVE);
> if (!SHMQueueIsDetached(&(MyProc->syncRepLinks)))
> SHMQueueDelete(&(MyProc->syncRepLinks));
> LWLockRelease(SyncRepLock);
> }

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2019-10-30 08:59:54 Re: [HACKERS] Block level parallel vacuum
Previous Message Ibrar Ahmed 2019-10-30 08:38:29 Proposal: Global Index