Skip to content

Commit b3055ab

Browse files
committed
Fix upper limit of superuser_reserved_connections, add limit for wal_senders
Should be limited to the maximum number of connections excluding autovacuum workers, not including. Add similar check for max_wal_senders, which should never be higher than max_connections.
1 parent da4efa1 commit b3055ab

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

doc/src/sgml/config.sgml

+10-6
Original file line numberDiff line numberDiff line change
@@ -2087,12 +2087,16 @@ SET ENABLE_SEQSCAN TO OFF;
20872087
</indexterm>
20882088
<listitem>
20892089
<para>
2090-
Specifies the maximum number of concurrent connections from standby
2091-
servers or streaming base backup clients (i.e., the maximum number of
2092-
simultaneously running WAL sender
2093-
processes). The default is zero. This parameter can only be set at
2094-
server start. <varname>wal_level</> must be set to <literal>archive</>
2095-
or <literal>hot_standby</> to allow connections from standby servers.
2090+
Specifies the maximum number of concurrent connections from
2091+
standby servers or streaming base backup clients (i.e., the
2092+
maximum number of simultaneously running WAL sender
2093+
processes). The default is zero, meaning replication is
2094+
disabled. WAL sender processes count towards the total number
2095+
of connections, so the parameter cannot be set higher than
2096+
<xref linkend="guc-max-connections">. This parameter can only
2097+
be set at server start. <varname>wal_level</> must be set
2098+
to <literal>archive</> or <literal>hot_standby</> to allow
2099+
connections from standby servers.
20962100
</para>
20972101
</listitem>
20982102
</varlistentry>

src/backend/postmaster/postmaster.c

+6-1
Original file line numberDiff line numberDiff line change
@@ -763,11 +763,16 @@ PostmasterMain(int argc, char *argv[])
763763
/*
764764
* Check for invalid combinations of GUC settings.
765765
*/
766-
if (ReservedBackends >= MaxBackends)
766+
if (ReservedBackends >= MaxConnections)
767767
{
768768
write_stderr("%s: superuser_reserved_connections must be less than max_connections\n", progname);
769769
ExitPostmaster(1);
770770
}
771+
if (max_wal_senders >= MaxConnections)
772+
{
773+
write_stderr("%s: max_wal_senders must be less than max_connections\n", progname);
774+
ExitPostmaster(1);
775+
}
771776
if (XLogArchiveMode && wal_level == WAL_LEVEL_MINIMAL)
772777
ereport(ERROR,
773778
(errmsg("WAL archival (archive_mode=on) requires wal_level \"archive\" or \"hot_standby\"")));

0 commit comments

Comments
 (0)