Thread: pgsql: Update parallel executor support to reuse the same DSM.

pgsql: Update parallel executor support to reuse the same DSM.

From
Robert Haas
Date:
Update parallel executor support to reuse the same DSM.

Commit b0b0d84b3d663a148022e900ebfc164284a95f55 purported to make it
possible to relaunch workers using the same parallel context, but it had
an unpleasant race condition: we might reinitialize after the workers
have sent their last control message but before they have dettached the
DSM, leaving to crashes.  Repair by introducing a new ParallelContext
operation, ReinitializeParallelDSM.

Adjust execParallel.c to use this new support, so that we can rescan a
Gather node by relaunching workers but without needing to recreate the
DSM.

Amit Kapila, with some adjustments by me.  Extracted from latest parallel
sequential scan patch.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/3a1f8611f2582df0a16bcd35caed2e1526387643

Modified Files
--------------
src/backend/access/transam/README.parallel |   10 +-
src/backend/access/transam/parallel.c      |  175 +++++++++++++++-------------
src/backend/executor/execParallel.c        |   33 ++++--
src/backend/executor/nodeGather.c          |   54 ++++++---
src/include/access/parallel.h              |    1 +
src/include/executor/execParallel.h        |    1 +
6 files changed, 166 insertions(+), 108 deletions(-)