pgsql: Fix TAP test for remove_temp_files_after_crash - Mailing list pgsql-committers

From Tomas Vondra
Subject pgsql: Fix TAP test for remove_temp_files_after_crash
Date
Msg-id E1lN3lw-0001RU-UJ@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Fix TAP test for remove_temp_files_after_crash

The test included in cd91de0d17 had two simple flaws.

Firstly, the number of rows was low and on some platforms (e.g. 32-bit)
the sort did not require on-disk sort, so on those machines it was not
testing the automatic removal.  The test was however failing, because
without any temporary files the base/pgsql_tmp directory was not even
created.  Fixed by increasing the rowcount to 5000, which should be high
engough on any platform.

Secondly, the test used a simple sleep to wait for the temporary file to
be created.  This is obviously problematic, because on slow machines (or
with valgrind, CLOBBER_CACHE_ALWAYS etc.) it may take a while to create
the temporary file.  But we also want the tests run reasonably fast.
Fixed by instead relying on a UNIQUE constraint, blocking the query that
created the temporary file.

Author: Euler Taveira
Reviewed-by: Tomas Vondra
Discussion: https://postgr.es/m/CAH503wDKdYzyq7U-QJqGn%3DGm6XmoK%2B6_6xTJ-Yn5WSvoHLY1Ww%40mail.gmail.com

Branch
------
master

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

Modified Files
--------------
src/test/recovery/t/022_crash_temp_files.pl | 60 ++++++++++++++++++++++-------
1 file changed, 47 insertions(+), 13 deletions(-)


pgsql-committers by date:

Previous
From: Michael Paquier
Date:
Subject: pgsql: Improve tab completion of IMPORT FOREIGN SCHEMA with \h in psql
Next
From: Tom Lane
Date:
Subject: pgsql: Don't leak malloc'd strings when a GUC setting is rejected.