pgsql: Make deadlock-parallel isolation test more robust. - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Make deadlock-parallel isolation test more robust.
Date
Msg-id E1hz6zA-0000N7-IY@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Make deadlock-parallel isolation test more robust.

This test failed fairly reproducibly on some CLOBBER_CACHE_ALWAYS
buildfarm animals.  The cause seems to be that if a parallel worker
is slow enough to reach its lock wait, it may not be released by
the first deadlock check run, and then later deadlock checks might
decide to unblock the d2 session instead of the d1 session, leaving
us in an undetected deadlock state (since the isolationtester client
is waiting for d1 to complete first).

Fix by introducing an additional lock wait at the end of the d2a1
step, ensuring that the deadlock checker will recognize that d1
has to be unblocked before d2a1 completes.

Also reduce max_parallel_workers_per_gather to 3 in this test.  With the
default max_worker_processes value, we were only getting one parallel
worker for the d2a1 step, which is not the case I hoped to test.  We
should get 3 for d1a2 and 2 for d2a1, as the code stands; and maybe 3
for d2a1 if somebody figures out why the last parallel worker slot isn't
free already.

Discussion: https://postgr.es/m/22195.1566077308@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/9be4ce4fa33594e035eb421894247e5af61393ce

Modified Files
--------------
src/test/isolation/expected/deadlock-parallel.out | 19 ++++++++----
src/test/isolation/specs/deadlock-parallel.spec   | 36 +++++++++++++++++++----
2 files changed, 43 insertions(+), 12 deletions(-)


pgsql-committers by date:

Previous
From: Peter Eisentraut
Date:
Subject: pgsql: Improve Assert output
Next
From: Peter Eisentraut
Date:
Subject: pgsql: Remove obsolete reference to Irix