Re: condition variable cleanup and subtransactions

Thomas Munro <thomas.munro@enterprisedb.com>

From: Thomas Munro <thomas.munro@enterprisedb.com>
To: Andres Freund <andres@anarazel.de>
Cc: Pg Hackers <pgsql-hackers@postgresql.org>, pgsql-committers <pgsql-committers@postgresql.org>, Robert Haas <robertmhaas@gmail.com>
Date: 2017-12-21T11:46:09Z
Lists: pgsql-hackers
On Fri, Dec 22, 2017 at 12:00 AM, Andres Freund <andres@anarazel.de> wrote:
> Oh. This seems to be a condition variable bug independent of PHJ. The
> problem is that the DSM segment etc all get cleaned up in
> *subtransaction* abort.
>
> Afaict it's a bug that AbortTransaction() does
> ConditionVariableCancelSleep() but AbortSubTransaction() does not,
> despite the latter releasing dsm segments via
> ResourceOwnerRelease(RESOURCE_RELEASE_BEFORE_LOCKS).
>
> Adding that seems to fix the crash.
>
> This seems like something we need to backpatch.

Agreed.  That affects any user of condition variables inside DSM
segments, including the released Parallel Index Scan and Parallel
Bitmap Heap Scan code.

-- 
Thomas Munro
http://www.enterprisedb.com


Commits

  1. Update obsolete sentence in README.parallel.

  2. Rewrite ConditionVariableBroadcast() to avoid live-lock.

  3. Tweak parallel hash join test case in hopes of improving stability.

  4. Rename pg_rewind's copy_file_range() to avoid conflict with new linux syscall.

  5. Fix some minor errors in new PHJ code.

  6. Fix EXPLAIN ANALYZE output for Parallel Hash.

  7. Fix rare assertion failure in parallel hash join.

  8. Cancel CV sleep during subtransaction abort.

  9. Add parallel-aware hash joins.

  10. Fix EXPLAIN ANALYZE of hash join when the leader doesn't participate.

  11. Add some regression tests that exercise hash join code.