Skip to content

Commit 6f0c9bc

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 c0751d3 commit 6f0c9bc

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

doc/src/sgml/config.sgml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1908,11 +1908,16 @@ SET ENABLE_SEQSCAN TO OFF;
19081908
</indexterm>
19091909
<listitem>
19101910
<para>
1911-
Specifies the maximum number of concurrent connections from standby
1912-
servers (i.e., the maximum number of simultaneously running WAL sender
1913-
processes). The default is zero. This parameter can only be set at
1914-
server start. <varname>wal_level</> must be set to <literal>archive</>
1915-
or <literal>hot_standby</> to allow connections from standby servers.
1911+
Specifies the maximum number of concurrent connections from
1912+
standby servers (i.e., the
1913+
maximum number of simultaneously running WAL sender
1914+
processes). The default is zero, meaning replication is
1915+
disabled. WAL sender processes count towards the total number
1916+
of connections, so the parameter cannot be set higher than
1917+
<xref linkend="guc-max-connections">. This parameter can only
1918+
be set at server start. <varname>wal_level</> must be set
1919+
to <literal>archive</> or <literal>hot_standby</> to allow
1920+
connections from standby servers.
19161921
</para>
19171922
</listitem>
19181923
</varlistentry>

src/backend/postmaster/postmaster.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -724,11 +724,16 @@ PostmasterMain(int argc, char *argv[])
724724
/*
725725
* Check for invalid combinations of GUC settings.
726726
*/
727-
if (ReservedBackends >= MaxBackends)
727+
if (ReservedBackends >= MaxConnections)
728728
{
729729
write_stderr("%s: superuser_reserved_connections must be less than max_connections\n", progname);
730730
ExitPostmaster(1);
731731
}
732+
if (max_wal_senders >= MaxConnections)
733+
{
734+
write_stderr("%s: max_wal_senders must be less than max_connections\n", progname);
735+
ExitPostmaster(1);
736+
}
732737
if (XLogArchiveMode && wal_level == WAL_LEVEL_MINIMAL)
733738
ereport(ERROR,
734739
(errmsg("WAL archival (archive_mode=on) requires wal_level \"archive\" or \"hot_standby\"")));

0 commit comments

Comments
 (0)