diff options
Diffstat (limited to 'src/backend/utils')
-rw-r--r-- | src/backend/utils/init/globals.c | 1 | ||||
-rw-r--r-- | src/backend/utils/init/postinit.c | 2 | ||||
-rw-r--r-- | src/backend/utils/misc/guc.c | 28 | ||||
-rw-r--r-- | src/backend/utils/misc/postgresql.conf.sample | 1 |
4 files changed, 27 insertions, 5 deletions
diff --git a/src/backend/utils/init/globals.c b/src/backend/utils/init/globals.c index 9f51929191d..33efb3c3cca 100644 --- a/src/backend/utils/init/globals.c +++ b/src/backend/utils/init/globals.c @@ -109,6 +109,7 @@ int maintenance_work_mem = 16384; */ int NBuffers = 1000; int MaxConnections = 90; +int max_worker_processes = 8; int MaxBackends = 0; int VacuumCostPageHit = 1; /* GUC parameters for vacuum */ diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c index 127f9273e85..2c7f0f17641 100644 --- a/src/backend/utils/init/postinit.c +++ b/src/backend/utils/init/postinit.c @@ -436,7 +436,7 @@ InitializeMaxBackends(void) /* the extra unit accounts for the autovacuum launcher */ MaxBackends = MaxConnections + autovacuum_max_workers + 1 + - GetNumShmemAttachedBgworkers(); + + max_worker_processes; /* internal error because the values were all checked previously */ if (MaxBackends > MAX_BACKENDS) diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index 3a7653698d3..d6200616de8 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -190,6 +190,7 @@ static const char *show_tcp_keepalives_idle(void); static const char *show_tcp_keepalives_interval(void); static const char *show_tcp_keepalives_count(void); static bool check_maxconnections(int *newval, void **extra, GucSource source); +static bool check_max_worker_processes(int *newval, void **extra, GucSource source); static bool check_autovacuum_max_workers(int *newval, void **extra, GucSource source); static bool check_effective_io_concurrency(int *newval, void **extra, GucSource source); static void assign_effective_io_concurrency(int newval, void *extra); @@ -2159,6 +2160,18 @@ static struct config_int ConfigureNamesInt[] = }, { + {"max_worker_processes", + PGC_POSTMASTER, + RESOURCES_ASYNCHRONOUS, + gettext_noop("Maximum number of concurrent worker processes."), + NULL, + }, + &max_worker_processes, + 8, 1, MAX_BACKENDS, + check_max_worker_processes, NULL, NULL + }, + + { {"log_rotation_age", PGC_SIGHUP, LOGGING_WHERE, gettext_noop("Automatic log file rotation will occur after N minutes."), NULL, @@ -8667,8 +8680,8 @@ show_tcp_keepalives_count(void) static bool check_maxconnections(int *newval, void **extra, GucSource source) { - if (*newval + GetNumShmemAttachedBgworkers() + autovacuum_max_workers + 1 > - MAX_BACKENDS) + if (*newval + autovacuum_max_workers + 1 + + max_worker_processes > MAX_BACKENDS) return false; return true; } @@ -8676,8 +8689,15 @@ check_maxconnections(int *newval, void **extra, GucSource source) static bool check_autovacuum_max_workers(int *newval, void **extra, GucSource source) { - if (MaxConnections + *newval + 1 + GetNumShmemAttachedBgworkers() > - MAX_BACKENDS) + if (MaxConnections + *newval + 1 + max_worker_processes > MAX_BACKENDS) + return false; + return true; +} + +static bool +check_max_worker_processes(int *newval, void **extra, GucSource source) +{ + if (MaxConnections + autovacuum_max_workers + 1 + *newval > MAX_BACKENDS) return false; return true; } diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample index 0d7249f4dbd..d69a02be87f 100644 --- a/src/backend/utils/misc/postgresql.conf.sample +++ b/src/backend/utils/misc/postgresql.conf.sample @@ -152,6 +152,7 @@ # - Asynchronous Behavior - #effective_io_concurrency = 1 # 1-1000; 0 disables prefetching +#max_worker_processes = 8 #------------------------------------------------------------------------------ |