Skip to content

Commit 63e719e

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 86ece4b commit 63e719e

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

doc/src/sgml/config.sgml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2114,12 +2114,16 @@ SET ENABLE_SEQSCAN TO OFF;
21142114
</indexterm>
21152115
<listitem>
21162116
<para>
2117-
Specifies the maximum number of concurrent connections from standby
2118-
servers or streaming base backup clients (i.e., the maximum number of
2119-
simultaneously running WAL sender
2120-
processes). The default is zero. This parameter can only be set at
2121-
server start. <varname>wal_level</> must be set to <literal>archive</>
2122-
or <literal>hot_standby</> to allow connections from standby servers.
2117+
Specifies the maximum number of concurrent connections from
2118+
standby servers or streaming base backup clients (i.e., the
2119+
maximum number of simultaneously running WAL sender
2120+
processes). The default is zero, meaning replication is
2121+
disabled. WAL sender processes count towards the total number
2122+
of connections, so the parameter cannot be set higher than
2123+
<xref linkend="guc-max-connections">. This parameter can only
2124+
be set at server start. <varname>wal_level</> must be set
2125+
to <literal>archive</> or <literal>hot_standby</> to allow
2126+
connections from standby servers.
21232127
</para>
21242128
</listitem>
21252129
</varlistentry>

src/backend/postmaster/postmaster.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -759,11 +759,16 @@ PostmasterMain(int argc, char *argv[])
759759
/*
760760
* Check for invalid combinations of GUC settings.
761761
*/
762-
if (ReservedBackends >= MaxBackends)
762+
if (ReservedBackends >= MaxConnections)
763763
{
764764
write_stderr("%s: superuser_reserved_connections must be less than max_connections\n", progname);
765765
ExitPostmaster(1);
766766
}
767+
if (max_wal_senders >= MaxConnections)
768+
{
769+
write_stderr("%s: max_wal_senders must be less than max_connections\n", progname);
770+
ExitPostmaster(1);
771+
}
767772
if (XLogArchiveMode && wal_level == WAL_LEVEL_MINIMAL)
768773
ereport(ERROR,
769774
(errmsg("WAL archival (archive_mode=on) requires wal_level \"archive\" or \"hot_standby\"")));

0 commit comments

Comments
 (0)