Re: Reduce ProcArrayLock contention

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Pavan Deolasee <pavan(dot)deolasee(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Reduce ProcArrayLock contention
Date: 2015-08-21 18:45:22
Message-ID: CA+TgmoZJE2vWLT2mgvOnrefJoOAFjCAM-mp8BR4bsNpsb8i+4A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Aug 21, 2015 at 2:31 PM, Andres Freund <andres(at)anarazel(dot)de> wrote:
> No, if it's paired like that, I don't think it's allowed to fail.
>
> But, as the code stands, there's absolutely no guarantee you're not
> seeing something like:
> P1: a = 0;
> P1: b = 0;
> P1: PGSemaphoreLock(&P1);
> P2: a = 1;
> P2: PGSemaphoreUnlock(&P1); -- unrelated, as e.g. earlier by ProcSendSignal
> P1: Assert(a == b == 1);
> P2: b = 1;
> P2: PGSemaphoreUnlock(&P1);
>
> if the pairing is like this there's no guarantees anymore, right? Even
> if a and be were set before P1's assert, the thing would be allowed to
> fail, because the store to a or b might each be visible since there's no
> enforced ordering.

Hmm, I see your point. So I agree with your proposed fix then. That
kinda sucks that we have to do all those gymnastics, though: that's a
lot more complicated than what we have right now.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2015-08-21 18:48:27 Re: More WITH
Previous Message Tom Lane 2015-08-21 18:39:45 Re: More WITH