pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Andres Freund <andres@anarazel.de>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Subject: Re: Re: [COMMITTERS] pgsql: Add some isolation tests for deadlock detection and resolution.
Date: Mon, 22 Feb 2016 09:29:53 -0500
Message-ID: <9953.1456151393@sss.pgh.pa.us> (raw)
In-Reply-To: <CA+TgmobOWq4GMkXzZM+Gjk8b7g5rMgMB8ArZX0QKmO167cabgA@mail.gmail.com>
References: <E1aTrXw-0005kd-Nl@gemulon.postgresql.org>
	<21023.1455200996@sss.pgh.pa.us>
	<CA+TgmoYh2UycJAaW+UONuXJhThyRD_Eq_1xDbivROLLYaSfb2Q@mail.gmail.com>
	<CA+TgmoYrakoJzjNm_QpAZ4wktTG=MbPVJZiKETGeeXWaQ1N=1Q@mail.gmail.com>
	<14581.1455205343@sss.pgh.pa.us>
	<20201.1455210279@sss.pgh.pa.us>
	<24444.1455251654@sss.pgh.pa.us>
	<CA+TgmoaV7Tjr4D2+JsW+bBSmnGo4GqgxqKLJ3D8CMr7=Ayhx0Q@mail.gmail.com>
	<1427.1455301014@sss.pgh.pa.us>
	<20160212232232.GA29473@awork2.anarazel.de>
	<1056.1455571766@sss.pgh.pa.us>
	<CA+TgmoZqOpSJk1H9U4JxbQuX5Ywzb0=ZVRnzZzBQj3RCJuzbLA@mail.gmail.com>
	<16182.1455721494@sss.pgh.pa.us>
	<28688.1455725891@sss.pgh.pa.us>
	<CA+TgmobOWq4GMkXzZM+Gjk8b7g5rMgMB8ArZX0QKmO167cabgA@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

Robert Haas <robertmhaas@gmail.com> writes:
> On Wed, Feb 17, 2016 at 9:48 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> I just had a rather disturbing thought to the effect that this entire
>> design --- ie, parallel workers taking out locks for themselves --- is
>> fundamentally flawed.  As far as I can tell from README.parallel,
>> parallel workers are supposed to exit (and, presumably, release their
>> locks) before the leader's transaction commits.  Releasing locks before
>> commit is wrong.  Do I need to rehearse why?

> No, you don't.  I've spent a good deal of time thinking about that problem.
> [ much snipped ]
> Unless I'm missing something, though, this is a fairly obscure
> problem.  Early release of catalog locks is desirable, and locks on
> scanned tables should be the same locks (or weaker) than already held
> by the master.  Other cases are rare.  I think.  It would be good to
> know if you think otherwise.

After further thought, what I think about this is that it's safe so long
as parallel workers are strictly read-only.  Given that, early lock
release after user table access is okay for the same reasons it's okay
after catalog accesses.  However, this is one of the big problems that
we'd have to have a solution for before we ever consider allowing
read-write parallelism.

So what distresses me about the current situation is that this is a large
stumbling block that I don't see documented anywhere.  It'd be good if you
transcribed some of this conversation into README.parallel.

(BTW, I don't believe your statement that transferring locks back to the
master would be deadlock-prone.  If the lock system treats locks held by
a lock group as effectively all belonging to one entity, then granting a
lock identical to one already held by another group member should never
fail.  I concur that it might be expensive performance-wise, though it
hardly seems like this would be a dominant factor compared to all the
other costs of setting up and tearing down parallel workers.)

			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



view thread (30+ messages)  latest in thread

Message-ID: <9953.1456151393@sss.pgh.pa.us>
Permalink:  ../9953.1456151393@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/9953.1456151393@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, robertmhaas@gmail.com, andres@anarazel.de, pgsql-hackers@postgresql.org
  Subject: Re: [COMMITTERS] pgsql: Add some isolation tests for deadlock detection and resolution.
  In-Reply-To: <9953.1456151393@sss.pgh.pa.us>
  References: <E1aTrXw-0005kd-Nl@gemulon.postgresql.org> <21023.1455200996@sss.pgh.pa.us> <CA+TgmoYh2UycJAaW+UONuXJhThyRD_Eq_1xDbivROLLYaSfb2Q@mail.gmail.com> <CA+TgmoYrakoJzjNm_QpAZ4wktTG=MbPVJZiKETGeeXWaQ1N=1Q@mail.gmail.com> <14581.1455205343@sss.pgh.pa.us> <20201.1455210279@sss.pgh.pa.us> <24444.1455251654@sss.pgh.pa.us> <CA+TgmoaV7Tjr4D2+JsW+bBSmnGo4GqgxqKLJ3D8CMr7=Ayhx0Q@mail.gmail.com> <1427.1455301014@sss.pgh.pa.us> <20160212232232.GA29473@awork2.anarazel.de> <1056.1455571766@sss.pgh.pa.us> <CA+TgmoZqOpSJk1H9U4JxbQuX5Ywzb0=ZVRnzZzBQj3RCJuzbLA@mail.gmail.com> <16182.1455721494@sss.pgh.pa.us> <28688.1455725891@sss.pgh.pa.us> <CA+TgmobOWq4GMkXzZM+Gjk8b7g5rMgMB8ArZX0QKmO167cabgA@mail.gmail.com> <9953.1456151393@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox