| From: | Jakub Wartak <jakub(dot)wartak(at)enterprisedb(dot)com> |
|---|---|
| To: | Heikki Linnakangas <hlinnaka(at)iki(dot)fi> |
| Cc: | Nathan Bossart <nathandbossart(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org |
| Subject: | Re: add --transfer-mode to pg_upgrade |
| Date: | 2026-12-04 08:12:52 |
| Message-ID: | CAKZiRmxvtUw6wa+oH9ZRVYcXd29bVy0sX2ZyVKw389t4ue3uWQ@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Thu, Dec 3, 2026 at 5:08 PM Heikki Linnakangas <hlinnaka(at)iki(dot)fi> wrote:
>
> On 03/12/2026 18:01, Nathan Bossart wrote:
> > pg_upgrade has a separate option for each of its file transfer modes
> > (--clone, --copy, --copy-file-range, --link, and --swap), which I find
> > somewhat silly given only one mode can be used at a time. The options are
> > scattered around the documentation and the --help output, and every new
> > mode means yet another one (I'm guilty of adding the most recent). ISTM we
> > ought to combine them.
> >
> > The attached patch adds --transfer-mode, which accepts the mode as its
> > argument (e.g., --transfer-mode=link). The documentation for each mode
> > moves to the new option, and the existing options are now listed as
> > deprecated spellings of it. They continue to work as before, and I doubt
> > we'll ever be able to remove them, but IMHO this is still an improvement.
>
> +1. I didn't read the patch, but I like the idea.
+1 too. We could also just fprintf(stderr) some info that the --link/--clone
are deprecated too and users should switch to --transfer-mode=XXX in future.
> > I also haven't touched pg_combinebackup, which has four of the same options,
> > but I'm happy to give it the same treatment if folks
> > like this.
I would like it to have it the same way. Historically pg_combinebackup got the
CoW copy_file_range()/ioctl(FICLONE) toggles exposed the same way how
pg_upgrade did it in the first place [1]. I've even proposed the generic
pg_copyfile_offload() stuff there [2] to kind of have generic way of using it,
but meh, it was overcomplicating things (thanks to Tomas for fixing it!).
> I hope we don't add too many more transfer modes for this to become a
> huge problem, but IMO --transfer-mode=<mode> just reads nicer.
Same here, but I'm afraid we'll organically gonna get way more of those things
due adapting to various OS facilities. Like I could already think of using it
for io_uring in pg_basebackup [3] (I'm using env PG_BASEBACKUP_NODIO as hack
there to disarm it, but --transfer-mode=iouring|no_iouring looks way better;
yes the thread is for pg_upgrade, but we could get this nice consistency
everywhere).
Also pg_combinebackup will certainly have to evolve to avoid double writing
to make it really fast/usable sooner or later and even back then Robert did
not say "no" to this concept ;), see [4], just we didn't know how to do such
"transfer".
-J.
[1] - https://www.postgresql.org/message-id/CAKZiRmyQ_F%2BOxHUi0%2Bpo9wnM%3DiwB0XUd%3D-ZT0ry_mOQJRnwmfA%40mail.gmail.com
[2] - https://www.postgresql.org/message-id/CAKZiRmx%2BENhxPb9L0Rhwc%2BMgiQi%3DGL3SrK2cHC5s_ioB%2Bkbu%3DQ%40mail.gmail.com
[3] - https://www.postgresql.org/message-id/CAKZiRmwwW-hDc3B6ERJB%2BpaX7RNSBcQLheq1KdsTf42cGuRvuA%40mail.gmail.com
[4] - https://www.postgresql.org/message-id/CA%2BTgmoZxPpWU11%2ByQCHr8obHK5nAyb96KpN25bk4PdX51dUFFQ%40mail.gmail.com
- read:
"wouldn't it be nice if we could have an future option in pg_combinebackup to
avoid double writes when used from restore hosts (right now we need to first
to reconstruct the original datadir from full and incremental backups on host
hosting backups and then TRANSFER it again and on target host?)"
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Xuneng Zhou | 2026-12-04 08:14:10 | Re: Small WAL replay perf improvements (smgropen()+reduce membarriers for LSN waiters) |
| Previous Message | Nikhil Sontakke | 2026-12-04 08:10:04 | Identity column silently stores a wrapped value when its sequence is wider than column |