Re: Adding a test for speculative insert abort case

From: Andres Freund <andres(at)anarazel(dot)de>
To: Melanie Plageman <melanieplageman(at)gmail(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Peter Geoghegan <pg(at)bowt(dot)ie>
Subject: Re: Adding a test for speculative insert abort case
Date: 2019-05-10 21:40:38
Message-ID: 20190510214038.5xt5fssdxrzx2yrs@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2019-05-01 11:41:48 -0700, Andres Freund wrote:
> I'm imagining something like
>
> if (pg_try_advisory_xact_lock(1))
> pg_advisory_xact_lock(2);
> else
> pg_advisory_xact_lock(1);
>
> in t1_lock_func. If you then make the session something roughly like
>
> s1: pg_advisory_xact_lock(1);
> s1: pg_advisory_xact_lock(2);
>
> s2: upsert t1 <blocking for 1>
> s1: pg_advisory_xact_unlock(1);
> s2: <continuing>
> s2: <blocking for 2>
> s1: insert into t1 values(1, 'someval');
> s1: pg_advisory_xact_unlock(2);
> s2: <continuing>
> s2: spec-conflict

Needed to be slightly more complicated than that, but not that much. See
the attached test. What do you think?

I think we should apply something like this (minus the WARNING, of
course). It's a bit complicated, but it seems worth covering this
special case.

Greetings,

Andres Freund

Attachment Content-Type Size
speculative-conflict.diff text/x-diff 13.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2019-05-11 00:32:31 Re: pg12 release notes
Previous Message Andrew Dunstan 2019-05-10 21:26:43 Re: Why is infinite_recurse test suddenly failing?