aboutsummaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorTomas Vondra <tomas.vondra@postgresql.org>2024-04-05 18:01:26 +0200
committerTomas Vondra <tomas.vondra@postgresql.org>2024-04-05 18:01:32 +0200
commitf8ce4ed78ca6e35bf135545e34bd49cd65d88ea2 (patch)
tree5d3b4e32f541fb34b89ba585d88f96ddbf924dad /doc/src
parent3c5ff36aba8a3df19967d0ddc1249c63417bb9b0 (diff)
downloadpostgresql-f8ce4ed78ca6e35bf135545e34bd49cd65d88ea2.tar.gz
postgresql-f8ce4ed78ca6e35bf135545e34bd49cd65d88ea2.zip
Allow copying files using clone/copy_file_range
Adds --clone/--copy-file-range options to pg_combinebackup, to allow copying files using file cloning or copy_file_range(). These methods may be faster than the standard block-by-block copy, but the main advantage is that they enable various features provided by CoW filesystems. This commit only uses these copy methods for files that did not change and can be copied as a whole from a single backup. These new copy methods may not be available on all platforms, in which case the command throws an error (immediately, even if no files would be copied as a whole). This early failure seems better than failing later when trying to copy the first file, after performing a lot of work on earlier files. If the requested copy method is available, but a checksum needs to be recalculated (e.g. because of a different checksum type), the file is still copied using the requested method, but it is also read for the checksum calculation. Depending on the filesystem this may be more expensive than just performing the simple copy, but it does enable the CoW benefits. Initial patch by Jakub Wartak, various reworks and improvements by me. Author: Tomas Vondra, Jakub Wartak Reviewed-by: Thomas Munro, Jakub Wartak, Robert Haas Discussion: https://postgr.es/m/3024283a-7491-4240-80d0-421575f6bb23%40enterprisedb.com
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/ref/pg_combinebackup.sgml45
1 files changed, 45 insertions, 0 deletions
diff --git a/doc/src/sgml/ref/pg_combinebackup.sgml b/doc/src/sgml/ref/pg_combinebackup.sgml
index 6f90dba281f..658e9a759c8 100644
--- a/doc/src/sgml/ref/pg_combinebackup.sgml
+++ b/doc/src/sgml/ref/pg_combinebackup.sgml
@@ -186,6 +186,51 @@ PostgreSQL documentation
</varlistentry>
<varlistentry>
+ <term><option>--clone</option></term>
+ <listitem>
+ <para>
+ Use efficient file cloning (also known as <quote>reflinks</quote> on
+ some systems) instead of copying files to the new data directory,
+ which can result in near-instantaneous copying of the data files.
+ </para>
+
+ <para>
+ If a backup manifest is not available or does not contain checksum of
+ the right type, file cloning will be used to copy the file, but the
+ file will be also read block-by-block for the checksum calculation.
+ </para>
+
+ <para>
+ File cloning is only supported on some operating systems and file
+ systems. If it is selected but not supported, the
+ <application>pg_combinebackup</application> run will error. At present,
+ it is supported on Linux (kernel 4.5 or later) with Btrfs and XFS (on
+ file systems created with reflink support), and on macOS with APFS.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>--copy-file-range</option></term>
+ <listitem>
+ <para>
+ Use the <function>copy_file_range</function> system call for efficient
+ copying. On some file systems this gives results similar to
+ <option>--clone</option>, sharing physical disk blocks, while on others
+ it may still copy blocks, but do so via an optimized path. At present,
+ it is supported on Linux and FreeBSD.
+ </para>
+
+ <para>
+ If a backup manifest is not available or does not contain checksum of
+ the right type, <function>copy_file_range</function> will be used to
+ copy the file, but the file will be also read block-by-block for the
+ checksum calculation.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
<term><option>-V</option></term>
<term><option>--version</option></term>
<listitem>