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: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Subject: Re: Re: [COMMITTERS] pgsql: Add some isolation tests for deadlock detection and resolution.
Date: Thu, 11 Feb 2016 23:34:14 -0500
Message-ID: <24444.1455251654@sss.pgh.pa.us> (raw)
In-Reply-To: <20201.1455210279@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>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

We're not out of the woods on this :-( ... jaguarundi, which is the first
of the CLOBBER_CACHE_ALWAYS animals to run these tests, didn't like them
at all.  I think I fixed the deadlock-soft-2 failure, but its take on
deadlock-hard is:

*** 17,25 ****
  step s6a7: LOCK TABLE a7; <waiting ...>
  step s7a8: LOCK TABLE a8; <waiting ...>
  step s8a1: LOCK TABLE a1; <waiting ...>
- step s8a1: <... completed>
  step s7a8: <... completed>
! error in steps s8a1 s7a8: ERROR:  deadlock detected
  step s8c: COMMIT;
  step s7c: COMMIT;
  step s6a7: <... completed>
--- 17,25 ----
  step s6a7: LOCK TABLE a7; <waiting ...>
  step s7a8: LOCK TABLE a8; <waiting ...>
  step s8a1: LOCK TABLE a1; <waiting ...>
  step s7a8: <... completed>
! step s8a1: <... completed>
! ERROR:  deadlock detected
  step s8c: COMMIT;
  step s7c: COMMIT;
  step s6a7: <... completed>

The problem here is that when the deadlock detector kills s8's
transaction, s7a8 is also left free to proceed, so there is a race
condition as to which query completion will get back to
isolationtester first.

One grotty way to handle that would be something like

-step "s7a8"	{ LOCK TABLE a8; }
+step "s7a8"	{ LOCK TABLE a8; SELECT pg_sleep(5); }

Or we could simplify the locking structure enough so that no other
transactions are released by the deadlock failure.  I do not know
exactly what you had in mind to be testing here?

			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: <24444.1455251654@sss.pgh.pa.us>
Permalink:  ../24444.1455251654@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/24444.1455251654@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, pgsql-hackers@postgresql.org
  Subject: Re: [COMMITTERS] pgsql: Add some isolation tests for deadlock detection and resolution.
  In-Reply-To: <24444.1455251654@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>

* 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