Re: pg_upgrade --copy-file-range

2024-03-28 Thread Tomas Vondra
On 3/28/24 21:45, Robert Haas wrote: > On Tue, Mar 26, 2024 at 2:09 PM Tomas Vondra > wrote: >> The patch I shared a couple minutes ago should fix this, effectively >> restoring the original debug behavior. I liked the approach with calling >> strategy_implementation a bit more, I wonder if

Re: pg_upgrade --copy-file-range

2024-03-28 Thread Robert Haas
On Tue, Mar 26, 2024 at 2:09 PM Tomas Vondra wrote: > The patch I shared a couple minutes ago should fix this, effectively > restoring the original debug behavior. I liked the approach with calling > strategy_implementation a bit more, I wonder if it'd be better to go > back to that for the

Re: pg_upgrade --copy-file-range

2024-03-26 Thread Tomas Vondra
On 3/25/24 15:31, Robert Haas wrote: > On Sat, Mar 23, 2024 at 9:37 AM Tomas Vondra > wrote: >> OK, that makes sense. Here's a patch that should work like this - in >> copy_file we check if we need to calculate checksums, and either use the >> requested copy method, or fall back to the

Re: pg_upgrade --copy-file-range

2024-03-26 Thread Jakub Wartak
On Sat, Mar 23, 2024 at 6:57 PM Tomas Vondra wrote: > On 3/23/24 14:47, Tomas Vondra wrote: > > On 3/23/24 13:38, Robert Haas wrote: > >> On Fri, Mar 22, 2024 at 8:26 PM Thomas Munro > >> wrote: [..] > > Yeah, that's in write_reconstructed_file() and the patch does not touch > > that at all. I

Re: pg_upgrade --copy-file-range

2024-03-25 Thread Robert Haas
On Sat, Mar 23, 2024 at 9:47 AM Tomas Vondra wrote: > BTW is there a reason why the code calls "write" and not "pg_pwrite"? I think it's mostly because I learned to code a really long time ago. -- Robert Haas EDB: http://www.enterprisedb.com

Re: pg_upgrade --copy-file-range

2024-03-25 Thread Robert Haas
On Sat, Mar 23, 2024 at 9:37 AM Tomas Vondra wrote: > OK, that makes sense. Here's a patch that should work like this - in > copy_file we check if we need to calculate checksums, and either use the > requested copy method, or fall back to the block-by-block copy. +Use efficient file

Re: pg_upgrade --copy-file-range

2024-03-23 Thread Tomas Vondra
On 3/23/24 14:47, Tomas Vondra wrote: > On 3/23/24 13:38, Robert Haas wrote: >> On Fri, Mar 22, 2024 at 8:26 PM Thomas Munro wrote: >>> Hmm, this discussion seems to assume that we only use >>> copy_file_range() to copy/clone whole segment files, right? That's >>> great and may even get most

Re: pg_upgrade --copy-file-range

2024-03-23 Thread Tomas Vondra
On 3/23/24 13:38, Robert Haas wrote: > On Fri, Mar 22, 2024 at 8:26 PM Thomas Munro wrote: >> Hmm, this discussion seems to assume that we only use >> copy_file_range() to copy/clone whole segment files, right? That's >> great and may even get most of the available benefit given typical >>

Re: pg_upgrade --copy-file-range

2024-03-23 Thread Tomas Vondra
On 3/22/24 19:40, Robert Haas wrote: > On Fri, Mar 22, 2024 at 1:22 PM Tomas Vondra > wrote: >> Right, this will happen: >> >> pg_combinebackup: error: unable to use accelerated copy when manifest >> checksums are to be calculated. Use --no-manifest >> >> Are you saying we should just

Re: pg_upgrade --copy-file-range

2024-03-23 Thread Robert Haas
On Fri, Mar 22, 2024 at 8:26 PM Thomas Munro wrote: > Hmm, this discussion seems to assume that we only use > copy_file_range() to copy/clone whole segment files, right? That's > great and may even get most of the available benefit given typical > databases with many segments of old data that

Re: pg_upgrade --copy-file-range

2024-03-22 Thread Thomas Munro
Hmm, this discussion seems to assume that we only use copy_file_range() to copy/clone whole segment files, right? That's great and may even get most of the available benefit given typical databases with many segments of old data that never changes, but... I think copy_write_range() allows us to

Re: pg_upgrade --copy-file-range

2024-03-22 Thread Robert Haas
On Fri, Mar 22, 2024 at 1:22 PM Tomas Vondra wrote: > Right, this will happen: > > pg_combinebackup: error: unable to use accelerated copy when manifest > checksums are to be calculated. Use --no-manifest > > Are you saying we should just silently override the copy method and do > the copy

Re: pg_upgrade --copy-file-range

2024-03-22 Thread Tomas Vondra
On 3/22/24 17:42, Robert Haas wrote: > On Fri, Mar 22, 2024 at 10:40 AM Tomas Vondra > wrote: >> There's one question, though. As it stands, there's a bit of asymmetry >> between handling CopyFile() on WIN32 and the clone/copy_file_range on >> other platforms). On WIN32, we simply automatically

Re: pg_upgrade --copy-file-range

2024-03-22 Thread Robert Haas
On Fri, Mar 22, 2024 at 10:40 AM Tomas Vondra wrote: > There's one question, though. As it stands, there's a bit of asymmetry > between handling CopyFile() on WIN32 and the clone/copy_file_range on > other platforms). On WIN32, we simply automatically switch to CopyFile > automatically, if we

Re: pg_upgrade --copy-file-range

2024-03-22 Thread Tomas Vondra
Here's a patch reworked along the lines from a couple days ago. The primary goals were to add clone/copy_file_range while minimizing unnecessary disruption, and overall cleanup of the patch. I'm not saying it's committable, but I think the patch is much easier to understand. The main change is

Re: pg_upgrade --copy-file-range

2024-03-20 Thread Jakub Wartak
Hi Tomas, > I took a quick look at the remaining part adding copy_file_range to > pg_combinebackup. The patch no longer applies, so I had to rebase it. > Most of the issues were trivial, but I had to fix a couple missing > prototypes - I added them to copy_file.h/c, mostly. > > 0001 is the

Re: pg_upgrade --copy-file-range

2024-03-19 Thread Tomas Vondra
Hi, I took a quick look at the remaining part adding copy_file_range to pg_combinebackup. The patch no longer applies, so I had to rebase it. Most of the issues were trivial, but I had to fix a couple missing prototypes - I added them to copy_file.h/c, mostly. 0001 is the minimal rebase + those

Re: pg_upgrade --copy-file-range

2024-03-05 Thread Thomas Munro
On Wed, Mar 6, 2024 at 2:43 AM Peter Eisentraut wrote: > As far as I can tell, the original pg_upgrade patch has been ready to > commit since October. Unless Thomas has any qualms that have not been > made explicit in this thread, I suggest we move ahead with that. pg_upgrade --copy-f

Re: pg_upgrade --copy-file-range

2024-03-05 Thread Peter Eisentraut
On 05.01.24 13:40, Jakub Wartak wrote: Random patch notes: - main meat is in v3-0002*, I hope i did not screw something seriously - in worst case: it is opt-in through switch, so the user always can stick to the classic copy - no docs so far - pg_copyfile_offload_supported() should actually be

Re: pg_upgrade --copy-file-range

2023-12-23 Thread Michael Paquier
On Sat, Dec 23, 2023 at 09:52:59AM +1300, Thomas Munro wrote: > As it happens I was just thinking about this particular patch because > I suddenly had a strong urge to teach pg_combinebackup to use > copy_file_range. I wonder if you had the same idea... Yeah, +1. That would make

Re: pg_upgrade --copy-file-range

2023-12-22 Thread Thomas Munro
On Sat, Dec 23, 2023 at 9:40 AM Peter Eisentraut wrote: > On 13.11.23 08:15, Peter Eisentraut wrote: > > On 08.10.23 07:15, Thomas Munro wrote: > >>> About your patch: > >>> > >>> I think you should have a "check" function called from > >>> check_new_cluster(). That check function can then also

Re: pg_upgrade --copy-file-range

2023-12-22 Thread Peter Eisentraut
On 13.11.23 08:15, Peter Eisentraut wrote: On 08.10.23 07:15, Thomas Munro wrote: About your patch: I think you should have a "check" function called from check_new_cluster().  That check function can then also handle the "not supported" case, and you don't need to handle that in

Re: pg_upgrade --copy-file-range

2023-11-12 Thread Peter Eisentraut
On 08.10.23 07:15, Thomas Munro wrote: About your patch: I think you should have a "check" function called from check_new_cluster(). That check function can then also handle the "not supported" case, and you don't need to handle that in parseCommandLine(). I suggest following the clone

Re: pg_upgrade --copy-file-range

2023-10-07 Thread Thomas Munro
On Mon, Jul 3, 2023 at 7:47 PM Peter Eisentraut wrote: > When we added --clone, copy_file_range() was available, but the problem > was that it was hard for the user to predict whether you'd get the fast > clone behavior or the slow copy behavior. That's the kind of thing you > want to know when

Re: pg_upgrade --copy-file-range

2023-07-03 Thread Peter Eisentraut
On 02.06.23 21:30, Thomas Munro wrote: I was just in a pg_upgrade unconference session at PGCon where the lack of $SUBJECT came up. This system call gives the kernel the option to use fast block cloning on XFS, ZFS (as of very recently), etc, and works on Linux and FreeBSD. It's probably much

pg_upgrade --copy-file-range

2023-06-02 Thread Thomas Munro
Hello, I was just in a pg_upgrade unconference session at PGCon where the lack of $SUBJECT came up. This system call gives the kernel the option to use fast block cloning on XFS, ZFS (as of very recently), etc, and works on Linux and FreeBSD. It's probably much the same as --clone mode on COW