pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tomas Vondra <tomas.vondra@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix race condition in remove_temp_files_after_crash TAP test
Date: Fri, 19 Mar 2021 17:21:57 +0000
Message-ID: <E1lNIov-0007QS-Kf@gemulon.postgresql.org> (raw)

Fix race condition in remove_temp_files_after_crash TAP test

The TAP test was written so that it was not waiting for the correct SQL
command, but for output from the preceding one.  This resulted in race
conditions, allowing the commands to run in a different order, not block
as expected and so on.  This fixes it by inverting the order of commands
where possible, so that observing the output guarantees the data was
inserted properly, and waiting for a lock to appear in pg_locks.

Discussion: https://postgr.es/m/CAH503wDKdYzyq7U-QJqGn%3DGm6XmoK%2B6_6xTJ-Yn5WSvoHLY1Ww%40mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/e589c4890b05044a04207c2797e7c8af6693ea5f

Modified Files
--------------
src/test/recovery/t/022_crash_temp_files.pl | 44 +++++++++++++++++++++++++++--
1 file changed, 42 insertions(+), 2 deletions(-)



Message-ID: <E1lNIov-0007QS-Kf@gemulon.postgresql.org>
Permalink:  ../E1lNIov-0007QS-Kf@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1lNIov-0007QS-Kf@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tomas.vondra@postgresql.org
  Subject: Re: pgsql: Fix race condition in remove_temp_files_after_crash TAP test
  In-Reply-To: <E1lNIov-0007QS-Kf@gemulon.postgresql.org>
  References: <E1lNIov-0007QS-Kf@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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