From 3a1f8611f2582df0a16bcd35caed2e1526387643 Mon Sep 17 00:00:00 2001 From: Robert Haas Date: Fri, 30 Oct 2015 10:43:00 +0100 Subject: 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. --- src/backend/access/transam/README.parallel | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/backend/access/transam/README.parallel') diff --git a/src/backend/access/transam/README.parallel b/src/backend/access/transam/README.parallel index dfcbafabf08..db9ac3d504d 100644 --- a/src/backend/access/transam/README.parallel +++ b/src/backend/access/transam/README.parallel @@ -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. -- cgit v1.2.3