]> granicus.if.org Git - postgresql/commit
Make deadlock-parallel isolation test more robust.
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 17 Aug 2019 22:15:38 +0000 (18:15 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 17 Aug 2019 22:15:38 +0000 (18:15 -0400)
commit9be4ce4fa33594e035eb421894247e5af61393ce
treebca79a1cf47341444d2b3128e7df423af2def700
parentd78d452bc5ac46a970e4fca2b31f3d533815c39a
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
src/test/isolation/expected/deadlock-parallel.out
src/test/isolation/specs/deadlock-parallel.spec