pgsql: Allow copying files using clone/copy_file_range

Поиск
Список
Период
Сортировка
От Tomas Vondra
Тема pgsql: Allow copying files using clone/copy_file_range
Дата
Msg-id E1rsm26-000eZI-Hx@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/f8ce4ed78ca6e35bf135545e34bd49cd65d88ea2

Modified Files
--------------
doc/src/sgml/ref/pg_combinebackup.sgml      |  45 ++++++
src/bin/pg_combinebackup/copy_file.c        | 206 +++++++++++++++++++++++-----
src/bin/pg_combinebackup/copy_file.h        |  18 ++-
src/bin/pg_combinebackup/pg_combinebackup.c |  45 +++++-
src/bin/pg_combinebackup/reconstruct.c      |   3 +-
src/bin/pg_combinebackup/reconstruct.h      |   1 +
src/tools/pgindent/typedefs.list            |   1 +
7 files changed, 278 insertions(+), 41 deletions(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: [MASSMAIL]pgsql: Suppress "variable may be used uninitialized" warning.
Следующее
От: Tomas Vondra
Дата:
Сообщение: pgsql: Remove unused variable in checksum_file()