Skip to content

Commit 703d311

Browse files
committed
[Issue #185] archive-get refactoring: multi-threading, batching, prefetchin, retrying and handling of '.partial' files
1 parent 439c27c commit 703d311

File tree

11 files changed

+1631
-281
lines changed

11 files changed

+1631
-281
lines changed

doc/pgprobackup.xml

Lines changed: 45 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3957,7 +3957,7 @@ pg_probackup delete -B <replaceable>backup_dir</replaceable> --instance <replace
39573957
<title>archive-push</title>
39583958
<programlisting>
39593959
pg_probackup archive-push -B <replaceable>backup_dir</replaceable> --instance <replaceable>instance_name</replaceable>
3960-
--wal-file-name=<replaceable>wal_file_name</replaceable>
3960+
--wal-file-name=<replaceable>wal_file_name</replaceable> [--wal-file-path=<replaceable>wal_file_path</replaceable>]
39613961
[--help] [--no-sync] [--compress] [--no-ready-rename] [--overwrite]
39623962
[-j <replaceable>num_threads</replaceable>] [--batch-size=<replaceable>batch_size</replaceable>]
39633963
[--archive-timeout=<replaceable>timeout</replaceable>]
@@ -3973,12 +3973,10 @@ pg_probackup archive-push -B <replaceable>backup_dir</replaceable> --instance <r
39733973
backup instance and the cluster do not match, this command
39743974
fails with the following error message: <literal>Refuse to push WAL
39753975
segment segment_name into archive. Instance parameters
3976-
mismatch.</literal> For each WAL file moved to the backup catalog, you
3977-
will see the following message in the <productname>PostgreSQL</productname> log file:
3978-
<literal>pg_probackup archive-push completed successfully</literal>.
3976+
mismatch.</literal>
39793977
</para>
39803978
<para>
3981-
If the files to be copied already exist in the backup catalog,
3979+
If the files to be copied already exists in the backup catalog,
39823980
<application>pg_probackup</application> computes and compares their checksums. If the
39833981
checksums match, <command>archive-push</command> skips the corresponding file and
39843982
returns a successful execution code. Otherwise, <command>archive-push</command>
@@ -4025,6 +4023,8 @@ pg_probackup archive-push -B <replaceable>backup_dir</replaceable> --instance <r
40254023
<title>archive-get</title>
40264024
<programlisting>
40274025
pg_probackup archive-get -B <replaceable>backup_dir</replaceable> --instance <replaceable>instance_name</replaceable> --wal-file-path=<replaceable>wal_file_path</replaceable> --wal-file-name=<replaceable>wal_file_name</replaceable>
4026+
[-j <replaceable>num_threads</replaceable>] [--batch-size=<replaceable>batch_size</replaceable>]
4027+
[--prefetch-dir=<replaceable>prefetch_dir_path</replaceable>] [--no-validate-wal]
40284028
[--help] [<replaceable>remote_options</replaceable>] [<replaceable>logging_options</replaceable>]
40294029
</programlisting>
40304030
<para>
@@ -4035,6 +4035,17 @@ pg_probackup archive-get -B <replaceable>backup_dir</replaceable> --instance <re
40354035
restoring backups using a WAL archive. You do not need to set
40364036
it manually.
40374037
</para>
4038+
4039+
<para>
4040+
To speed up recovery, you can specify the <option>-j</option> option
4041+
to run <command>archive-get</command> on multiple threads.
4042+
If you provide the <option>--batch-size</option> option, WAL segments
4043+
will be copied in batches of the specified size.
4044+
</para>
4045+
4046+
<para>
4047+
For details, see section <link linkend="pbk-archiving-options">Archiving Options</link>.
4048+
</para>
40384049
</refsect3>
40394050
</refsect2>
40404051
<refsect2 id="pbk-options">
@@ -4777,7 +4788,8 @@ pg_probackup archive-get -B <replaceable>backup_dir</replaceable> --instance <re
47774788
<listitem>
47784789
<para>
47794790
Sets the maximum number of files that can be copied into the archive
4780-
by a single <command>archive-push</command> process.
4791+
by a single <command>archive-push</command> process, or from
4792+
the archive by a single <command>archive-get</command> process.
47814793
</para>
47824794
</listitem>
47834795
</varlistentry>
@@ -4789,6 +4801,7 @@ pg_probackup archive-get -B <replaceable>backup_dir</replaceable> --instance <re
47894801
Sets the timeout for considering existing <literal>.part</literal>
47904802
files to be stale. By default, <application>pg_probackup</application>
47914803
waits 300 seconds.
4804+
This option can be used only with <xref linkend="pbk-archive-push"/> command.
47924805
</para>
47934806
</listitem>
47944807
</varlistentry>
@@ -4800,6 +4813,7 @@ pg_probackup archive-get -B <replaceable>backup_dir</replaceable> --instance <re
48004813
Do not rename status files in the <literal>archive_status</literal> directory.
48014814
This option should be used only if <parameter>archive_command</parameter>
48024815
contains multiple commands.
4816+
This option can be used only with <xref linkend="pbk-archive-push"/> command.
48034817
</para>
48044818
</listitem>
48054819
</varlistentry>
@@ -4811,6 +4825,31 @@ pg_probackup archive-get -B <replaceable>backup_dir</replaceable> --instance <re
48114825
Do not sync copied WAL files to disk. You can use this flag to speed
48124826
up archiving process. Using this flag can result in WAL archive
48134827
corruption in case of operating system or hardware crash.
4828+
This option can be used only with <xref linkend="pbk-archive-push"/> command.
4829+
</para>
4830+
</listitem>
4831+
</varlistentry>
4832+
4833+
<varlistentry>
4834+
<term><option>--prefetch-dir=<replaceable>path</replaceable></option></term>
4835+
<listitem>
4836+
<para>
4837+
Directory used to store prefetched WAL segments if <option>--batch-size</option> option is used.
4838+
Directory must be located on the same filesystem and on the same mountpoint the
4839+
<literal>PGDATA/pg_wal</literal> is located.
4840+
By default files are stored in <literal>PGDATA/pg_wal/pbk_prefetch</literal> directory.
4841+
This option can be used only with <xref linkend="pbk-archive-get"/> command.
4842+
</para>
4843+
</listitem>
4844+
</varlistentry>
4845+
4846+
<varlistentry>
4847+
<term><option>--no-validate-wal</option></term>
4848+
<listitem>
4849+
<para>
4850+
Do not validate prefetched WAL file before using it.
4851+
Use this option if you want to increase the speed of recovery.
4852+
This option can be used only with <xref linkend="pbk-archive-get"/> command.
48144853
</para>
48154854
</listitem>
48164855
</varlistentry>

0 commit comments

Comments
 (0)