pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Add an isolation test to exercise parallel-worker deadlock resol
Date: Thu, 01 Aug 2019 15:50:12 +0000
Message-ID: <E1htDLI-00088F-To@gemulon.postgresql.org> (raw)

Add an isolation test to exercise parallel-worker deadlock resolution.

Commit a1c1af2a1 added logic in the deadlock checker to handle lock
grouping, but it was very poorly tested, as evidenced by the bug
fixed in 3420851a2.  Add a test case that exercises that a bit better
(and catches the bug --- if you revert 3420851a2, this will hang).

Since it's pretty hard to get parallel workers to take exclusive
regular locks that their parents don't already have, this test operates
by creating a deadlock among advisory locks taken in parallel workers.
To make that happen, we must override the parallel-safety labeling of
the advisory-lock functions, which we do by putting them in mislabeled,
non-inlinable wrapper functions.

We also have to remove the redundant PreventAdvisoryLocksInParallelMode
checks in lockfuncs.c.  That seems fine though; if some user accidentally
does what this test is intentionally doing, not much harm will ensue.
(If there are any remaining bugs that are reachable that way, they're
probably reachable in other ways too.)

Discussion: https://postgr.es/m/3243.1564437314@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/da9456d22a7697ef2c5ba9dd1402d948b2ec7f09

Modified Files
--------------
src/backend/utils/adt/lockfuncs.c                 | 29 --------
src/test/isolation/expected/deadlock-parallel.out | 47 ++++++++++++
src/test/isolation/isolation_schedule             |  1 +
src/test/isolation/specs/deadlock-parallel.spec   | 89 +++++++++++++++++++++++
4 files changed, 137 insertions(+), 29 deletions(-)



Message-ID: <E1htDLI-00088F-To@gemulon.postgresql.org>
Permalink:  ../E1htDLI-00088F-To@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1htDLI-00088F-To@gemulon.postgresql.org

 · 

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
  Subject: Re: pgsql: Add an isolation test to exercise parallel-worker deadlock resol
  In-Reply-To: <E1htDLI-00088F-To@gemulon.postgresql.org>
  References: <E1htDLI-00088F-To@gemulon.postgresql.org>

* 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