mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
Add new GUC reserved_connections.
This provides a way to reserve connection slots for non-superusers. The slots reserved via the new GUC are available only to users who have the new predefined role pg_use_reserved_connections. superuser_reserved_connections remains as a final reserve in case reserved_connections has been exhausted. Patch by Nathan Bossart. Reviewed by Tushar Ahuja and by me. Discussion: http://postgr.es/m/20230119194601.GA4105788@nathanxps13
This commit is contained in:
@ -708,6 +708,37 @@ include_dir 'conf.d'
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry id="guc-reserved-connections" xreflabel="reserved_connections">
|
||||
<term><varname>reserved_connections</varname> (<type>integer</type>)
|
||||
<indexterm>
|
||||
<primary><varname>reserved_connections</varname> configuration parameter</primary>
|
||||
</indexterm>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Determines the number of connection <quote>slots</quote> that are
|
||||
reserved for connections by roles with privileges of the
|
||||
<link linkend="predefined-roles-table"><literal>pg_used_reserved_connections</literal></link>
|
||||
role. Whenever the number of free connection slots is greater than
|
||||
<xref linkend="guc-superuser-reserved-connections"/> but less than or
|
||||
equal to the sum of <varname>superuser_reserved_connections</varname>
|
||||
and <varname>reserved_connections</varname>, new connections will be
|
||||
accepted only for superusers and roles with privileges of
|
||||
<literal>pg_use_reserved_connections</literal>. If
|
||||
<varname>superuser_reserved_connections</varname> or fewer connection
|
||||
slots are available, new connections will be accepted only for
|
||||
superusers.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The default value is zero connections. The value must be less than
|
||||
<varname>max_connections</varname> minus
|
||||
<varname>superuser_reserved_connections</varname>. This parameter can
|
||||
only be set at server start.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry id="guc-superuser-reserved-connections"
|
||||
xreflabel="superuser_reserved_connections">
|
||||
<term><varname>superuser_reserved_connections</varname>
|
||||
@ -725,12 +756,16 @@ include_dir 'conf.d'
|
||||
number of active concurrent connections is at least
|
||||
<varname>max_connections</varname> minus
|
||||
<varname>superuser_reserved_connections</varname>, new
|
||||
connections will be accepted only for superusers.
|
||||
connections will be accepted only for superusers. The connection slots
|
||||
reserved by this parameter are intended as final reserve for emergency
|
||||
use after the slots reserved by
|
||||
<xref linkend="guc-reserved-connections"/> have been exhausted.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The default value is three connections. The value must be less
|
||||
than <varname>max_connections</varname>.
|
||||
than <varname>max_connections</varname> minus
|
||||
<varname>reserved_connections</varname>.
|
||||
This parameter can only be set at server start.
|
||||
</para>
|
||||
</listitem>
|
||||
|
@ -689,6 +689,11 @@ DROP ROLE doomed_role;
|
||||
and <link linkend="sql-lock"><command>LOCK TABLE</command></link> on all
|
||||
relations.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>pg_use_reserved_connections</entry>
|
||||
<entry>Allow use of connection slots reserved via
|
||||
<xref linkend="guc-reserved-connections"/>.</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</table>
|
||||
|
Reference in New Issue
Block a user