Skip to content

Commit 84f6fb8

Browse files
committed
Fix IsUnderPostmaster/EXEC_BACKEND confusion
1 parent 1565891 commit 84f6fb8

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

src/backend/bootstrap/bootstrap.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,10 @@ AuxiliaryProcessMain(int argc, char *argv[])
359359
SetProcessingMode(BootstrapProcessing);
360360
IgnoreSystemIndexes = true;
361361

362+
/* Initialize MaxBackends (if under postmaster, was done already) */
363+
if (!IsUnderPostmaster)
364+
InitializeMaxBackends();
365+
362366
BaseInit();
363367

364368
/*

src/backend/tcop/postgres.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3654,10 +3654,8 @@ PostgresMain(int argc, char *argv[], const char *username)
36543654
*/
36553655
CreateDataDirLockFile(false);
36563656

3657-
/* In EXEC_BACKEND, this was set via BackendParameters */
3658-
#ifndef EXEC_BACKEND
3657+
/* Initialize MaxBackends (if under postmaster, was done already) */
36593658
InitializeMaxBackends();
3660-
#endif
36613659
}
36623660

36633661
/* Early initialization */

src/backend/utils/init/postinit.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,11 @@ pg_split_opts(char **argv, int *argcp, char *optstr)
427427
* This must be called after modules have had the chance to register background
428428
* workers in shared_preload_libraries, and before shared memory size is
429429
* determined.
430+
*
431+
* Note that in EXEC_BACKEND environment, the value is passed down from
432+
* postmaster to subprocesses via BackendParameters in SubPostmasterMain; only
433+
* postmaster itself and processes not under postmaster control should call
434+
* this.
430435
*/
431436
void
432437
InitializeMaxBackends(void)

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