aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/init/postinit.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/utils/init/postinit.c')
-rw-r--r--src/backend/utils/init/postinit.c50
1 files changed, 49 insertions, 1 deletions
diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c
index 2b65ef3deb0..4a207a73917 100644
--- a/src/backend/utils/init/postinit.c
+++ b/src/backend/utils/init/postinit.c
@@ -58,7 +58,7 @@
#include "utils/acl.h"
#include "utils/builtins.h"
#include "utils/fmgroids.h"
-#include "utils/guc.h"
+#include "utils/guc_hooks.h"
#include "utils/memutils.h"
#include "utils/pg_locale.h"
#include "utils/portal.h"
@@ -564,6 +564,54 @@ InitializeMaxBackends(void)
}
/*
+ * GUC check_hook for max_connections
+ */
+bool
+check_max_connections(int *newval, void **extra, GucSource source)
+{
+ if (*newval + autovacuum_max_workers + 1 +
+ max_worker_processes + max_wal_senders > MAX_BACKENDS)
+ return false;
+ return true;
+}
+
+/*
+ * GUC check_hook for autovacuum_max_workers
+ */
+bool
+check_autovacuum_max_workers(int *newval, void **extra, GucSource source)
+{
+ if (MaxConnections + *newval + 1 +
+ max_worker_processes + max_wal_senders > MAX_BACKENDS)
+ return false;
+ return true;
+}
+
+/*
+ * GUC check_hook for max_worker_processes
+ */
+bool
+check_max_worker_processes(int *newval, void **extra, GucSource source)
+{
+ if (MaxConnections + autovacuum_max_workers + 1 +
+ *newval + max_wal_senders > MAX_BACKENDS)
+ return false;
+ return true;
+}
+
+/*
+ * GUC check_hook for max_wal_senders
+ */
+bool
+check_max_wal_senders(int *newval, void **extra, GucSource source)
+{
+ if (MaxConnections + autovacuum_max_workers + 1 +
+ max_worker_processes + *newval > MAX_BACKENDS)
+ return false;
+ return true;
+}
+
+/*
* Early initialization of a backend (either standalone or under postmaster).
* This happens even before InitPostgres.
*