Commit b3055ab4 authored by Magnus Hagander's avatar Magnus Hagander

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.
parent da4efa13
...@@ -2087,12 +2087,16 @@ SET ENABLE_SEQSCAN TO OFF; ...@@ -2087,12 +2087,16 @@ SET ENABLE_SEQSCAN TO OFF;
</indexterm> </indexterm>
<listitem> <listitem>
<para> <para>
Specifies the maximum number of concurrent connections from standby Specifies the maximum number of concurrent connections from
servers or streaming base backup clients (i.e., the maximum number of standby servers or streaming base backup clients (i.e., the
simultaneously running WAL sender maximum number of simultaneously running WAL sender
processes). The default is zero. This parameter can only be set at processes). The default is zero, meaning replication is
server start. <varname>wal_level</> must be set to <literal>archive</> disabled. WAL sender processes count towards the total number
or <literal>hot_standby</> to allow connections from standby servers. of connections, so the parameter cannot be set higher than
<xref linkend="guc-max-connections">. This parameter can only
be set at server start. <varname>wal_level</> must be set
to <literal>archive</> or <literal>hot_standby</> to allow
connections from standby servers.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
......
...@@ -763,11 +763,16 @@ PostmasterMain(int argc, char *argv[]) ...@@ -763,11 +763,16 @@ PostmasterMain(int argc, char *argv[])
/* /*
* Check for invalid combinations of GUC settings. * Check for invalid combinations of GUC settings.
*/ */
if (ReservedBackends >= MaxBackends) if (ReservedBackends >= MaxConnections)
{ {
write_stderr("%s: superuser_reserved_connections must be less than max_connections\n", progname); write_stderr("%s: superuser_reserved_connections must be less than max_connections\n", progname);
ExitPostmaster(1); ExitPostmaster(1);
} }
if (max_wal_senders >= MaxConnections)
{
write_stderr("%s: max_wal_senders must be less than max_connections\n", progname);
ExitPostmaster(1);
}
if (XLogArchiveMode && wal_level == WAL_LEVEL_MINIMAL) if (XLogArchiveMode && wal_level == WAL_LEVEL_MINIMAL)
ereport(ERROR, ereport(ERROR,
(errmsg("WAL archival (archive_mode=on) requires wal_level \"archive\" or \"hot_standby\""))); (errmsg("WAL archival (archive_mode=on) requires wal_level \"archive\" or \"hot_standby\"")));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment