Re: condition variable cleanup and subtransactions

Robert Haas <robertmhaas@gmail.com>

From: Robert Haas <robertmhaas@gmail.com>
To: Thomas Munro <thomas.munro@enterprisedb.com>
Cc: Andres Freund <andres@anarazel.de>, Pg Hackers <pgsql-hackers@postgresql.org>, pgsql-committers <pgsql-committers@postgresql.org>
Date: 2017-12-21T14:25:27Z
Lists: pgsql-hackers
On Thu, Dec 21, 2017 at 6:46 AM, Thomas Munro
<thomas.munro@enterprisedb.com> wrote:
> 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.

Fixed.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


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.