Make GIN tests using injection points concurrent-safe
authorMichael Paquier <[email protected]>
Wed, 10 Apr 2024 04:48:13 +0000 (13:48 +0900)
committerMichael Paquier <[email protected]>
Wed, 10 Apr 2024 04:48:13 +0000 (13:48 +0900)
f587338dec87 has introduced in the test module injection_points a SQL
function called injection_points_set_local(), that can be used to make
all the injection points linked to the process where they are attached,
discarded automatically if any remain once the process exits.

e2e3b8ae9ed7 has added a NO_INSTALLCHECK to the test module to prevent
the use of installcheck.  Now that there is a way to make the test
concurrent-safe, let's use it and remove the installcheck restriction.

Concurrency issues could be easily reproduced by running in a tight
loop a command like this one, in src/test/modules/gin/ (hardcoding
pg_sleep() after attaching injection points enlarges the race window)
and a second test suite like contrib/btree_gin/:

  make installcheck USE_MODULE_DB=1

Reviewed-by: Andrey Borodin
Discussion: https://postgr.es/m/[email protected]

src/test/modules/gin/Makefile
src/test/modules/gin/expected/gin_incomplete_splits.out
src/test/modules/gin/meson.build
src/test/modules/gin/sql/gin_incomplete_splits.sql

index da4c9cea5ef1a7549621e0ea1a5d80d65d171aaa..e007e38ac27c6376dce768921c0e3d417666e7a9 100644 (file)
@@ -4,9 +4,6 @@ EXTRA_INSTALL = src/test/modules/injection_points
 
 REGRESS = gin_incomplete_splits
 
-# The injection points are cluster-wide, so disable installcheck
-NO_INSTALLCHECK = 1
-
 ifdef USE_PGXS
 PG_CONFIG = pg_config
 PGXS := $(shell $(PG_CONFIG) --pgxs)
index 973a8ce6c84c0d238c567b12356b706b4c9f4580..15574e547ac9a317251d7069deb8364c583d3df8 100644 (file)
 -- This uses injection points to cause errors that leave some page
 -- splits in "incomplete" state
 create extension injection_points;
+-- Make all injection points local to this process, for concurrency.
+SELECT injection_points_set_local();
+ injection_points_set_local 
+----------------------------
+(1 row)
+
 -- Use the index for all the queries
 set enable_seqscan=off;
 -- Print a NOTICE whenever an incomplete split gets fixed
index 5ec0760a276740073ea03f1d5c1768ed83dfbe95..9734b51de2d4b0dd6ec6c7e4b778b445a3b41df5 100644 (file)
@@ -12,7 +12,5 @@ tests += {
     'sql': [
       'gin_incomplete_splits',
     ],
-    # The injection points are cluster-wide, so disable installcheck
-    'runningcheck': false,
   },
 }
index ea3667b38d0f485b701e3911f6d1986cb4f1f15f..ebf0f620f0c1a195a017f58ec9241563e07ab4a0 100644 (file)
@@ -14,6 +14,9 @@
 -- splits in "incomplete" state
 create extension injection_points;
 
+-- Make all injection points local to this process, for concurrency.
+SELECT injection_points_set_local();
+
 -- Use the index for all the queries
 set enable_seqscan=off;