Re: Re: [COMMITTERS] pgsql: Introduce group locking to prevent parallel processes from deadl

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Re: [COMMITTERS] pgsql: Introduce group locking to prevent parallel processes from deadl
Date: 2016-02-21 17:45:36
Message-ID: 13467.1456076736@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

I wrote:
> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
>> Yeah, you're right. Attached is a draft patch that tries to clean up
>> that and a bunch of other things that you raised.

> I've been reviewing this patch, and I had a question: why do we need to
> bother with a lockGroupLeaderIdentifier field? It seems totally redundant
> with the leader's pid field, ie, why doesn't BecomeLockGroupMember simply
> compare leader->pid with the PID it's passed? For some more safety, it
> could also verify that leader->lockGroupLeader == leader; but I don't
> see what the extra field is buying us.

Here is a proposed patch that gets rid of lockGroupLeaderIdentifier.

I concluded that the "leader->lockGroupLeader == leader" test is
necessary, because we don't ever reset the pid field of a dead PGPROC
until it's re-used. However, with that check, this seems isomorphic to
the existing code because lockGroupLeader is reset to NULL at all the same
places that lockGroupLeaderIdentifier is reset. So we do not need both of
those fields.

regards, tom lane

Attachment Content-Type Size
remove-lockGroupLeaderIdentifier.patch text/x-diff 7.1 KB

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Joe Conway 2016-02-21 18:17:51 Re: pgsql: Cosmetic improvements in new config_info code.
Previous Message Tom Lane 2016-02-21 16:38:29 pgsql: Cosmetic improvements in new config_info code.

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2016-02-21 18:05:23 Re: a raft of parallelism-related bug fixes
Previous Message Tom Lane 2016-02-21 16:38:29 pgsql: Cosmetic improvements in new config_info code.