aboutsummaryrefslogtreecommitdiff
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 12:10:20 -0400
commit05c0059b3573a0423370d98789b5f292fb296041 (patch)
treea023dbc9ae648e38116c5ee10e344c567fe73f94 /src
parenta2a718b2231a84bc120c4c81d12c9350ad78e3d4 (diff)
downloadpostgresql-05c0059b3573a0423370d98789b5f292fb296041.tar.gz
postgresql-05c0059b3573a0423370d98789b5f292fb296041.zip
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 7d587ef652e..a4aefe401e4 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -4566,6 +4566,9 @@ SubPostmasterMain(int argc, char *argv[])
{
int cookie;
+ /* do this as early as possible; in particular, before InitProcess() */
+ IsBackgroundWorker = true;
+
/* Close the postmaster's sockets */
ClosePostmasterPorts(false);