1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

Allow BASE_BACKUP to be throttled

A new MAX_RATE option allows imposing a limit to the network transfer
rate from the server side.  This is useful to limit the stress that
taking a base backup has on the server.

pg_basebackup is now able to specify a value to the server, too.

Author: Antonin Houska

Patch reviewed by Stefan Radomski, Andres Freund, Zoltán Böszörményi,
Fujii Masao, and Álvaro Herrera.
This commit is contained in:
Alvaro Herrera
2014-02-27 18:55:57 -03:00
parent 1161d895d8
commit ef5856fd9b
7 changed files with 306 additions and 20 deletions

View File

@ -1772,7 +1772,7 @@ The commands accepted in walsender mode are:
</varlistentry>
<varlistentry>
<term>BASE_BACKUP [<literal>LABEL</literal> <replaceable>'label'</replaceable>] [<literal>PROGRESS</literal>] [<literal>FAST</literal>] [<literal>WAL</literal>] [<literal>NOWAIT</literal>]</term>
<term>BASE_BACKUP [<literal>LABEL</literal> <replaceable>'label'</replaceable>] [<literal>PROGRESS</literal>] [<literal>FAST</literal>] [<literal>WAL</literal>] [<literal>NOWAIT</literal>] [<literal>MAX_RATE</literal> <replaceable>rate</replaceable>]</term>
<listitem>
<para>
Instructs the server to start streaming a base backup.
@ -1840,7 +1840,21 @@ The commands accepted in walsender mode are:
the waiting and the warning, leaving the client responsible for
ensuring the required log is available.
</para>
</listitem>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>MAX_RATE</literal> <replaceable>rate</></term>
<listitem>
<para>
Limit (throttle) the maximum amount of data transferred from server
to client per unit of time. The expected unit is kilobytes per second.
If this option is specified, the value must either be equal to zero
or it must fall within the range from 32 kB through 1 GB (inclusive).
If zero is passed or the option is not specified, no restriction is
imposed on the transfer.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>

View File

@ -188,6 +188,27 @@ PostgreSQL documentation
</listitem>
</varlistentry>
<varlistentry>
<term><option>-r <replaceable class="parameter">rate</replaceable></option></term>
<term><option>--max-rate=<replaceable class="parameter">rate</replaceable></option></term>
<listitem>
<para>
The maximum transfer rate of data transferred from the server. Values are
in kilobytes per second. Use a suffix of <literal>M</> to indicate megabytes
per second. A suffix of <literal>k</> is also accepted, and has no effect.
Valid values are between 32 kilobytes per second and 1024 megabytes per second.
</para>
<para>
The purpose is to limit the impact of <application>pg_basebackup</application>
on the running server.
</para>
<para>
This option always affects transfer of the data directory. Transfer of
WAL files is only affected if the collection method is <literal>fetch</literal>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-R</option></term>
<term><option>--write-recovery-conf</option></term>