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: Wed, 17 Feb 2016 10:04:54 -0500
Message-ID: <16182.1455721494@sss.pgh.pa.us> (raw)
In-Reply-To: <CA+TgmoZqOpSJk1H9U4JxbQuX5Ywzb0=ZVRnzZzBQj3RCJuzbLA@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>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
Robert Haas <robertmhaas@gmail.com> writes:
> On Tue, Feb 16, 2016 at 2:59 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Not to be neglected also is that (I believe) this gives the right answer,
>> whereas isolationtester's existing query is currently completely broken by
>> parallel queries, and it doesn't understand non-conflicting lock modes
>> either. (It did, at least partially, before commit 38f8bdcac4982215;
>> I am not sure that taking out the mode checks was a good idea. But
>> putting them back would make the query slower yet.)
> The reason I took that out is because it breaks the deadlock-soft
> test. It's possible to have a situation where no granted lock
> conflicts with an awaited lock. If that happens, the old query
> wrongly concluded that the waiting process was not in fact waiting.
> (Consider A hold AccessShareLock, B awaits AccessExclusiveLock, C now
> requests AccessShareLock and *waits*.)
Ah, well, with this patch the deadlock-soft test still passes.
> As for the patch itself, I'm having trouble grokking what it's trying
> to do. I think it might be worth having a comment defining precisely
> what we mean by "A blocks B". I would define "A blocks B" in general
> as either A holds a lock which conflicts with one sought by B
> (hard-blocked) or A awaits a lock which conflicts with one sought by B
> and precedes it in the wait queue (soft-blocked).
Yes, that is exactly what I implemented ... and it's something you can't
find out from pg_locks. I'm not sure how that view could be made to
expose wait-queue ordering.
> For parallel queries, there's a further relevant distinction when we
> say "A blocks B". We might mean either that (1) process B cannot
> resume execution until the lock conflict is resolved or (2) the group
> leader for process B cannot complete the current parallel operation
> until the lock conflict is resolved.
The definition I used in this patch is "some member of A's lock group
blocks some member of B's lock group", because that corresponds directly
to whether A is preventing B's query from completing, which is what
isolationtester wants to know --- and, I would argue, it's generally what
any client would want to know. 99.9% of clients would just as soon not be
aware of parallel workers lurking underneath the pg_backend_pid() values
that they see for their sessions.
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
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: <16182.1455721494@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>
* 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