postgresql/src
Tomas Vondra f8ce4ed78c 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
2024-04-05 18:01:32 +02:00
..
backend Suppress "variable may be used uninitialized" warning. 2024-04-05 10:58:30 -04:00
bin Allow copying files using clone/copy_file_range 2024-04-05 18:01:32 +02:00
common Tidy up after incremental JSON parser patch 2024-04-04 12:41:55 -04:00
fe_utils Allow dbname to be written as part of connstring via pg_basebackup's -R option. 2024-03-21 10:50:33 +05:30
include Align blocks in incremental backups to BLCKSZ 2024-04-05 16:30:01 +02:00
interfaces Fix old, misleading comment for PGRES_POLLING_ACTIVE. 2024-04-04 16:22:11 -04:00
makefiles Remove AIX support 2024-02-28 15:17:23 +04:00
pl Avoid possible longjmp-induced logic error in PLy_trigger_build_args. 2024-04-01 15:15:03 -04:00
port Inline pg_popcount() for small buffers. 2024-04-03 12:22:02 -05:00
template Remove AIX support 2024-02-28 15:17:23 +04:00
test Allow synced slots to have their inactive_since. 2024-04-05 09:48:49 +05:30
timezone Update time zone data files to tzdata release 2024a. 2024-02-01 15:57:53 -05:00
tools Allow copying files using clone/copy_file_range 2024-04-05 18:01:32 +02:00
tutorial Update copyright for 2024 2024-01-03 20:49:05 -05:00
.gitignore
DEVELOPERS
Makefile Remove distprep 2023-11-06 15:18:04 +01:00
Makefile.global.in Remove make function vpathsearch 2024-01-29 07:24:59 +01:00
Makefile.shlib Remove AIX support 2024-02-28 15:17:23 +04:00
meson.build Update copyright for 2024 2024-01-03 20:49:05 -05:00
nls-global.mk Remove distprep 2023-11-06 15:18:04 +01:00