Detach parallel DSM segment after workers have exited When a parallel worker query fails in the leader while its workers are still starting up, DestroyParallelContext() requested the termination of the workers and detached the DSM segment right away, before waiting for them to exit. A worker that had not attached to the segment yet then found it gone and failed with "could not map dynamic shared memory segment" or some other DSM-related failure, which was confusing.
DestroyParallelContext() now waits for the workers to exit before detaching the segment. Such a worker attaches successfully and exits on the termination request, logging the same message as any other worker stopped by its leader. Author: Shihao Zhong <[email protected]> Discussion: https://postgr.es/m/cagrkxqq7d+b+xdcnr0oumg55ej421hpj3sawonu2uc0vkqa...@mail.gmail.com Backpatch-through: 15 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/f836f25b6f095f3b23762026831d2fab6117087c Modified Files -------------- src/backend/access/transam/parallel.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-)
