1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-28 11:44:57 +03:00

Update parallel executor support to reuse the same DSM.

Commit b0b0d84b3d 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.
This commit is contained in:
Robert Haas
2015-10-30 10:43:00 +01:00
parent c6baec92fc
commit 3a1f8611f2
6 changed files with 166 additions and 108 deletions

View File

@@ -222,7 +222,9 @@ pattern looks like this:
ExitParallelMode();
If desired, after WaitForParallelWorkersToFinish() has been called, another
call to LaunchParallelWorkers() can be made using the same parallel context.
Calls to these two functions can be alternated any number of times before
destroying the parallel context.
If desired, after WaitForParallelWorkersToFinish() has been called, the
context can be reset so that workers can be launched anew using the same
parallel context. To do this, first call ReinitializeParallelDSM() to
reinitialize state managed by the parallel context machinery itself; then,
perform any other necessary resetting of state; after that, you can again
call LaunchParallelWorkers.