summaryrefslogtreecommitdiff
path: root/src/backend/postmaster
diff options
context:
space:
mode:
authorTom Lane2018-03-08 16:25:26 +0000
committerTom Lane2018-03-08 16:25:26 +0000
commit4e0c743c18bf5435a4850510c5c74b3521c3e1e5 (patch)
tree548ba5c052c971a450f9f0bc5db10521b9946a69 /src/backend/postmaster
parentf9f8784c8b3050aaec52da88a6e41b3e3f576b96 (diff)
Fix cross-checking of ReservedBackends/max_wal_senders/MaxConnections.
We were independently checking ReservedBackends < MaxConnections and max_wal_senders < MaxConnections, but because walsenders aren't allowed to use superuser-reserved connections, that's really the wrong thing. Correct behavior is to insist on ReservedBackends + max_wal_senders being less than MaxConnections. Fix the code and associated documentation. This has been wrong for a long time, but since the situation probably hardly ever arises in the field (especially pre-v10, when the default for max_wal_senders was zero), no back-patch. Discussion: https://postgr.es/m/28271.1520195491@sss.pgh.pa.us
Diffstat (limited to 'src/backend/postmaster')
-rw-r--r--src/backend/postmaster/postmaster.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index f3ddf828bbe..660f3185e6b 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -202,9 +202,9 @@ char *ListenAddresses;
/*
* ReservedBackends is the number of backends reserved for superuser use.
- * This number is taken out of the pool size given by MaxBackends so
+ * This number is taken out of the pool size given by MaxConnections so
* number of backend slots available to non-superusers is
- * (MaxBackends - ReservedBackends). Note what this really means is
+ * (MaxConnections - ReservedBackends). Note what this really means is
* "if there are <= ReservedBackends connections available, only superusers
* can make new connections" --- pre-existing superuser connections don't
* count against the limit.
@@ -882,14 +882,11 @@ PostmasterMain(int argc, char *argv[])
/*
* Check for invalid combinations of GUC settings.
*/
- if (ReservedBackends >= MaxConnections)
+ if (ReservedBackends + max_wal_senders >= MaxConnections)
{
- write_stderr("%s: superuser_reserved_connections must be less than max_connections\n", progname);
- ExitPostmaster(1);
- }
- if (max_wal_senders >= MaxConnections)
- {
- write_stderr("%s: max_wal_senders must be less than max_connections\n", progname);
+ write_stderr("%s: superuser_reserved_connections (%d) plus max_wal_senders (%d) must be less than max_connections (%d)\n",
+ progname,
+ ReservedBackends, max_wal_senders, MaxConnections);
ExitPostmaster(1);
}
if (XLogArchiveMode > ARCHIVE_MODE_OFF && wal_level == WAL_LEVEL_MINIMAL)