Re: Re: [COMMITTERS] pgsql: Add some isolation tests for deadlock detection and resolution.

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Re: [COMMITTERS] pgsql: Add some isolation tests for deadlock detection and resolution.
Date: 2016-02-12 12:43:50
Message-ID: CA+TgmoaV7Tjr4D2+JsW+bBSmnGo4GqgxqKLJ3D8CMr7=Ayhx0Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On Thu, Feb 11, 2016 at 11:34 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> 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?

Basically just that the deadlock actually got detected. That may
sound a bit weak, but considering we had no test for it at all before
this...

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Pavel Stehule 2016-02-12 13:02:22 Re: [COMMITTERS] pgsql: Code cleanup in the wake of recent LWLock refactoring.
Previous Message Amit Kapila 2016-02-12 09:37:14 Re: [COMMITTERS] pgsql: Code cleanup in the wake of recent LWLock refactoring.

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2016-02-12 12:46:23 Re: Optimization for updating foreign tables in Postgres FDW
Previous Message Etsuro Fujita 2016-02-12 12:19:41 Re: Optimization for updating foreign tables in Postgres FDW