Re: Adding a test for speculative insert abort case

From: Melanie Plageman <melanieplageman(at)gmail(dot)com>
To: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, Ashwin Agrawal <aagrawal(at)pivotal(dot)io>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Adding a test for speculative insert abort case
Date: 2019-05-01 18:18:57
Message-ID: CAAKRu_bSJXxcESRBKkdNOwbkqueD+69os=O5g8r0Ch3e5nN3xg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Apr 30, 2019 at 7:14 PM Thomas Munro <thomas(dot)munro(at)gmail(dot)com> wrote:

> 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
>
> Yes, I agree it would be nice to have a framework like this.

Greenplum actually has a fault injection framework that, I believe, works
similarly to what you are describing -- i.e. sets a variable in shared
memory.
There is an extension, gp_inject_fault, which allows you to set the faults.
Andreas Scherbaum wrote a blog post about how to use it [1].

The Greenplum implementation is not documented particularly well in the
code,
but, it is something that folks working on Greenplum have talked about
modifying
and proposing to Postgres.

[1] http://engineering.pivotal.io/post/testing_greenplum_database_using_fault_injection/

--
Melanie Plageman

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2019-05-01 18:41:48 Re: Adding a test for speculative insert abort case
Previous Message Sergei Kornilov 2019-05-01 18:18:12 Re: using index or check in ALTER TABLE SET NOT NULL