pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tomas Vondra <tomas.vondra@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Allow using copy_file_range in write_reconstructed_file
Date: Fri, 05 Apr 2024 17:25:34 +0000
Message-ID: <E1rsnJl-000fLD-J7@gemulon.postgresql.org> (raw)

Allow using copy_file_range in write_reconstructed_file

This commit allows using copy_file_range() for efficient combining of
data from multiple files, instead of simply reading/writing the blocks.
Depending on the filesystem and other factors (size of the increment,
distribution of modified blocks etc.) this may be faster than the
block-by-block copy, but more importantly it enables various features
provided by CoW filesystems.

If a checksum needs to be calculated for the file, the same strategy as
when copying whole files is used - copy_file_range is used to copy the
blocks, but the file is also read for the checksum calculation.

While the checksum calculation is rarely needed when cloning whole
files, when reconstructing the files from multiple backups it needs to
happen almost always (the only exception is when the user specified
--no-manifest).

Author: Tomas Vondra
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/ac81101551326ddf4c5cb804c75bd3e8c56506ba

Modified Files
--------------
src/bin/pg_combinebackup/reconstruct.c | 134 ++++++++++++++++++++++++++-------
1 file changed, 106 insertions(+), 28 deletions(-)



Message-ID: <E1rsnJl-000fLD-J7@gemulon.postgresql.org>
Permalink:  ../E1rsnJl-000fLD-J7@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1rsnJl-000fLD-J7@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: tomas.vondra@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Allow using copy_file_range in write_reconstructed_file
  In-Reply-To: <E1rsnJl-000fLD-J7@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox