pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Test additional speculative conflict scenarios.
3+ messages / 2 participants
[nested] [flat]

* pgsql: Test additional speculative conflict scenarios.
@ 2020-02-12 00:43  Andres Freund <andres@anarazel.de>
  0 siblings, 1 reply; 3+ messages in thread

From: Andres Freund @ 2020-02-12 00:43 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Test additional speculative conflict scenarios.

Previously, the speculative insert tests did not cover the case when a
tuple t is inserted into a table with a unique index on a column but
before it can insert into the index, a concurrent transaction has
inserted a conflicting value into the index and the insertion of tuple t
must be aborted.

The basic permutation is one session successfully inserts into the table
and an associated unique index while a concurrent session successfully
inserts into the table but discovers a conflict before inserting into
the index and must abort the insertion.

Several variants on this include:
- swap which session is successful
- first session insert transaction does not commit, so second session
must wait on a transaction lock
- first session insert does not "complete", so second session must wait
on a speculative insertion lock

Also, refactor the existing TOAST table upsert test to be in the same
spec and reuse the steps.

Author: Melanie Plageman, Ashwin Agrawal, Andres Freund
Reviewed-by: Andres Freund, Taylor Vesely
Discussion: https://postgr.es/m/CAAKRu_ZRmxy_OEryfY3G8Zp01ouhgw59_-_Cm8n7LzRH5BAvng@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/43e08419708a938236e76cd50de2db512e1c3a0c

Modified Files
--------------
.../expected/insert-conflict-specconflict.out      | 277 +++++++++++++++++----
.../isolation/expected/insert-conflict-toast.out   |  15 --
src/test/isolation/isolation_schedule              |   1 -
.../specs/insert-conflict-specconflict.spec        | 140 +++++++++--
.../isolation/specs/insert-conflict-toast.spec     |  51 ----
5 files changed, 356 insertions(+), 128 deletions(-)



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: pgsql: Test additional speculative conflict scenarios.
@ 2020-02-12 05:07  Michael Paquier <michael@paquier.xyz>
  parent: Andres Freund <andres@anarazel.de>
  0 siblings, 1 reply; 3+ messages in thread

From: Michael Paquier @ 2020-02-12 05:07 UTC (permalink / raw)
  To: Andres Freund <andres@anarazel.de>; +Cc: pgsql-committers@lists.postgresql.org

On Wed, Feb 12, 2020 at 12:43:09AM +0000, Andres Freund wrote:
> Test additional speculative conflict scenarios.
> 
> Previously, the speculative insert tests did not cover the case when a
> tuple t is inserted into a table with a unique index on a column but
> before it can insert into the index, a concurrent transaction has
> inserted a conflicting value into the index and the insertion of tuple t
> must be aborted.

guaibasaurus is unhappy after this commit:
https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=guaibasaurus&dt=2020-02-12%2004%3A17%3A0...

Here is the culprit diff:
 application_namelocktype       mode           granted

+               transactionid  ExclusiveLock  t
 isolation/insert-conflict-specconflict-s1speculative tokenShareLock f
 isolation/insert-conflict-specconflict-s1transactionid ExclusiveLock  t
 isolation/insert-conflict-specconflict-s2speculative tokenExclusiveLock  t      
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: pgsql: Test additional speculative conflict scenarios.
@ 2020-02-12 05:10  Andres Freund <andres@anarazel.de>
  parent: Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 3+ messages in thread

From: Andres Freund @ 2020-02-12 05:10 UTC (permalink / raw)
  To: Michael Paquier <michael@paquier.xyz>; +Cc: pgsql-committers@lists.postgresql.org

Hi,

On 2020-02-12 14:07:17 +0900, Michael Paquier wrote:
> On Wed, Feb 12, 2020 at 12:43:09AM +0000, Andres Freund wrote:
> > Test additional speculative conflict scenarios.
> > 
> > Previously, the speculative insert tests did not cover the case when a
> > tuple t is inserted into a table with a unique index on a column but
> > before it can insert into the index, a concurrent transaction has
> > inserted a conflicting value into the index and the insertion of tuple t
> > must be aborted.
> 
> guaibasaurus is unhappy after this commit:
> https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=guaibasaurus&dt=2020-02-12%2004%3A17%3A0...
> 
> Here is the culprit diff:
>  application_namelocktype       mode           granted
> 
> +               transactionid  ExclusiveLock  t
>  isolation/insert-conflict-specconflict-s1speculative tokenShareLock f
>  isolation/insert-conflict-specconflict-s1transactionid ExclusiveLock  t
>  isolation/insert-conflict-specconflict-s2speculative tokenExclusiveLock  t      

Yea, working on the fix already (just restricting application name to
'isolation/insert-conflict-specconflict-s%').

Greetings,

Andres Freund





^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2020-02-12 05:10 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-02-12 00:43 pgsql: Test additional speculative conflict scenarios. Andres Freund <andres@anarazel.de>
2020-02-12 05:07 ` Michael Paquier <michael@paquier.xyz>
2020-02-12 05:10   ` Andres Freund <andres@anarazel.de>

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