Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1aVmfT-0004go-9k for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Feb 2016 20:56:19 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1aVmfS-0003Uo-5b for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Feb 2016 20:56:18 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aVme7-0001w5-1N for pgsql-hackers@postgresql.org; Tue, 16 Feb 2016 20:54:55 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aVme4-00019A-BT for pgsql-hackers@postgresql.org; Tue, 16 Feb 2016 20:54:53 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id u1GKsoeQ013399; Tue, 16 Feb 2016 15:54:50 -0500 From: Tom Lane To: Robert Haas cc: "pgsql-hackers@postgresql.org" Subject: Re: Re: [COMMITTERS] pgsql: Introduce group locking to prevent parallel processes from deadl In-reply-to: References: <27041.1455388321@sss.pgh.pa.us> <22842.1455474783@sss.pgh.pa.us> <30320.1455488783@sss.pgh.pa.us> Comments: In-reply-to Robert Haas message dated "Mon, 15 Feb 2016 19:41:28 -0500" Date: Tue, 16 Feb 2016 15:54:50 -0500 Message-ID: <13398.1455656090@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Robert Haas writes: > 1. It removes the groupLeader flag from PGPROC. You're right: we don't need it. It occurs to me that this claim is bogus: > We institute a further coding rule that a process cannot join or leave a lock > group while owning any PROCLOCK. Therefore, given a lock manager lock > sufficient to examine PROCLOCK *proclock, it also safe to examine > proclock->tag.myProc->lockGroupLeader (but not the other fields mentioned in > the previous paragraph). Yes, we can legislate that workers have to join before taking any lock, and if processes only leave the group at death then that end of it is not a problem either; but it is patently not the case that a process will hold no locks when it calls BecomeLockGroupLeader(). We may be able to salvage this simplification anyway, but it will require a tighter specification of when it's safe to look at proclock->tag.myProc->lockGroupLeader. Another possibility is to forget about executor-time BecomeLockGroupLeader(), and just say that any process that isn't a worker always becomes its own group leader at startup. Then the above para is true as written. I don't know what downsides this might have; do your changes in the lock manager try to optimize the null-lockGroupLeader case? regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers