Skip to content

Commit 445dbd8

Browse files
committed
Fix ReinitializeParallelDSM to tolerate finding no error queues.
Commit d466335 changed things so that shm_toc_lookup would fail with an error rather than silently returning NULL in the hope that such failures would be reported in a useful way rather than via a system crash. However, it overlooked the fact that the lookup of PARALLEL_KEY_ERROR_QUEUE in ReinitializeParallelDSM is expected to fail when no DSM segment was created in the first place; in that case, we end up with a backend-private memory segment that still contains an entry for PARALLEL_KEY_FIXED but no others. Consequently a benign failure to initialize parallelism can escalate into an elog(ERROR); repair. Discussion: http://postgr.es/m/CA+Tgmob8LFw55DzH1QEREpBEA9RJ_W_amhBFCVZ6WMwUhVpOqg@mail.gmail.com
1 parent c6755e2 commit 445dbd8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/backend/access/transam/parallel.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,9 +428,10 @@ ReinitializeParallelDSM(ParallelContext *pcxt)
428428
fps = shm_toc_lookup(pcxt->toc, PARALLEL_KEY_FIXED, false);
429429
fps->last_xlog_end = 0;
430430

431-
/* Recreate error queues. */
431+
/* Recreate error queues (if they exist). */
432432
error_queue_space =
433-
shm_toc_lookup(pcxt->toc, PARALLEL_KEY_ERROR_QUEUE, false);
433+
shm_toc_lookup(pcxt->toc, PARALLEL_KEY_ERROR_QUEUE, true);
434+
Assert(pcxt->nworkers == 0 || error_queue_space != NULL);
434435
for (i = 0; i < pcxt->nworkers; ++i)
435436
{
436437
char *start;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy