• Tom Lane's avatar
    Make deadlock-parallel isolation test more robust. · 9be4ce4f
    Tom Lane authored
    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
    9be4ce4f
deadlock-parallel.spec 4.61 KB