• Tom Lane's avatar
    Add an isolation test to exercise parallel-worker deadlock resolution. · da9456d2
    Tom Lane authored
    Commit a1c1af2a added logic in the deadlock checker to handle lock
    grouping, but it was very poorly tested, as evidenced by the bug
    fixed in 3420851a.  Add a test case that exercises that a bit better
    (and catches the bug --- if you revert 3420851a, this will hang).
    
    Since it's pretty hard to get parallel workers to take exclusive
    regular locks that their parents don't already have, this test operates
    by creating a deadlock among advisory locks taken in parallel workers.
    To make that happen, we must override the parallel-safety labeling of
    the advisory-lock functions, which we do by putting them in mislabeled,
    non-inlinable wrapper functions.
    
    We also have to remove the redundant PreventAdvisoryLocksInParallelMode
    checks in lockfuncs.c.  That seems fine though; if some user accidentally
    does what this test is intentionally doing, not much harm will ensue.
    (If there are any remaining bugs that are reachable that way, they're
    probably reachable in other ways too.)
    
    Discussion: https://postgr.es/m/3243.1564437314@sss.pgh.pa.us
    da9456d2
isolation_schedule 2.05 KB