On Fri, Dec 8, 2017 at 2:23 PM, Thomas Munro <thomas.mu...@enterprisedb.com> wrote: > On Fri, Dec 8, 2017 at 1:57 PM, Peter Geoghegan <p...@bowt.ie> wrote: >> 1. Thomas' barrier abstraction was added by commit 1145acc7. I think >> that you should use a static barrier in tuplesort.c now, and rip out >> the ConditionVariable fields in the Sharedsort struct. > > ... So I think we'd need to add an extra barrier > function that lets you change the party size of a static barrier.
Something like the attached (untested), which would allow _bt_begin_parallel() to call BarrierInit(&barrier, request + 1), then BarrierForgetParticipants(&barrier, request - pcxt->nworkers_launched), and then all the condition variable loop stuff can be replaced with a well placed call to BarrierArriveAndWait(&barrier, WAIT_EVENT_SOMETHING_SOMETHING). -- Thomas Munro http://www.enterprisedb.com
barrier-forget-participants-v1.patch
Description: Binary data