mirror of
https://github.com/postgres/postgres.git
synced 2025-06-16 06:01:02 +03:00
Add new GUC, max_worker_processes, limiting number of bgworkers.
In 9.3, there's no particular limit on the number of bgworkers; instead, we just count up the number that are actually registered, and use that to set MaxBackends. However, that approach causes problems for Hot Standby, which needs both MaxBackends and the size of the lock table to be the same on the standby as on the master, yet it may not be desirable to run the same bgworkers in both places. 9.3 handles that by failing to notice the problem, which will probably work fine in nearly all cases anyway, but is not theoretically sound. A further problem with simply counting the number of registered workers is that new workers can't be registered without a postmaster restart. This is inconvenient for administrators, since bouncing the postmaster causes an interruption of service. Moreover, there are a number of applications for background processes where, by necessity, the background process must be started on the fly (e.g. parallel query). While this patch doesn't actually make it possible to register new background workers after startup time, it's a necessary prerequisite. Patch by me. Review by Michael Paquier.
This commit is contained in:
@ -146,4 +146,9 @@ typedef struct BackgroundWorker
|
||||
The <filename>worker_spi</> contrib module contains a working example,
|
||||
which demonstrates some useful techniques.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The maximum number of registered background workers is limited by
|
||||
<xref linkend="guc-max-worker-processes">.
|
||||
</para>
|
||||
</chapter>
|
||||
|
@ -1595,6 +1595,25 @@ include 'filename'
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry id="guc-max-worker-processes" xreflabel="max_worrker_processes">
|
||||
<term><varname>max_worker_processes</varname> (<type>integer</type>)</term>
|
||||
<indexterm>
|
||||
<primary><varname>max_worker_processes</> configuration parameter</primary>
|
||||
</indexterm>
|
||||
<listitem>
|
||||
<para>
|
||||
Sets the maximum number of background processes that the system
|
||||
can support. This parameter can only be set at server start.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
When running a standby server, you must set this parameter to the
|
||||
same or higher value than on the master server. Otherwise, queries
|
||||
will not be allowed in the standby server.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</sect2>
|
||||
</sect1>
|
||||
|
Reference in New Issue
Block a user