summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2014-07-30 11:25:58 -0400
committerRobert Haas <rhaas@postgresql.org>2014-07-30 11:58:03 -0400
commitaeebacff114634ffa07b5299ee6c41b219717bc3 (patch)
treee3f2d2e621fb97d18db5635688cbcd6692d1faa6 /src
parent98c5fe5d0df8549972f46c324d9c6b18b4c4ecc0 (diff)
Fix mishandling of background worker PGPROCs in EXEC_BACKEND builds.
InitProcess() relies on IsBackgroundWorker to decide whether the PGPROC for a new backend should be taken from ProcGlobal's freeProcs or from bgworkerFreeProcs. In EXEC_BACKEND builds, InitProcess() is called sooner than in non-EXEC_BACKEND builds, and IsBackgroundWorker wasn't getting initialized soon enough. Report by Noah Misch. Diagnosis and fix by me.
Diffstat (limited to 'src')
-rw-r--r--src/backend/postmaster/postmaster.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index 9548caa0aeb..39fa5641914 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -4672,6 +4672,9 @@ SubPostmasterMain(int argc, char *argv[])
{
int shmem_slot;
+ /* do this as early as possible; in particular, before InitProcess() */
+ IsBackgroundWorker = true;
+
/* Close the postmaster's sockets */
ClosePostmasterPorts(false);