Re: Adding a test for speculative insert abort case - Mailing list pgsql-hackers

From Thomas Munro
Subject Re: Adding a test for speculative insert abort case
Date
Msg-id CA+hUKGJBe0qModjjwWD07N61DYr49bAWxNusnJKX-2FqtSWe9Q@mail.gmail.com
Whole thread Raw
In response to Adding a test for speculative insert abort case  (Melanie Plageman <melanieplageman@gmail.com>)
Responses Re: Adding a test for speculative insert abort case  (Melanie Plageman <melanieplageman@gmail.com>)
List pgsql-hackers
On Wed, May 1, 2019 at 12:16 PM Melanie Plageman
<melanieplageman@gmail.com> wrote:
> s1: insert into t1 values(1, 'someval') on conflict(id) do update set val = 'someotherval';
> s1: pause in ExecInsert before calling ExecInsertIndexTuples
> s2: insert into t1 values(1, 'someval');
> s2: continue
>
> We don't know of a way to add this scenario to the current isolation framework.
>
> Can anyone think of a good way to put this codepath under test?

Hi Melanie,

I think it'd be nice to have a set of macros that can create wait
points in the C code that isolation tests can control, in a special
build.  Perhaps there could be shm hash table of named wait points in
shared memory; if DEBUG_WAIT_POINT("foo") finds that "foo" is not
present, it continues, but if it finds an entry it waits for it to go
away.  Then isolation tests could add/remove names and signal a
condition variable to release waiters.

I contemplated that while working on SKIP LOCKED, which had a bunch of
weird edge cases that I tested by inserting throw-away wait-point code
like this:

https://www.postgresql.org/message-id/CADLWmXXss83oiYD0pn_SfQfg%2ByNEpPbPvgDb8w6Fh--jScSybA%40mail.gmail.com

-- 
Thomas Munro
https://enterprisedb.com



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Adding a test for speculative insert abort case
Next
From: Amit Kapila
Date:
Subject: Re: Unhappy about API changes in the no-fsm-for-small-rels patch