small pg_combinebackup improvements

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: small pg_combinebackup improvements
Date: 2024-10-30 19:50:53
Message-ID: CA+TgmoaD7dBYPqe7kMtO0dyto7rd0rUh7joh=JPUSaFszKY6Pg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Here are two small patches to improve pg_combinebackup slightly.

0001: I noticed that there is some logic in reconstruct.c that
constructs a pathname of the form a/b//c instead of a/b/c. AFAICT,
this still works fine; it just looks ugly. It's possible to get one of
these pathnames to show up in an error message if you have a corrupted
backup, e.g.:

pg_combinebackup: error: could not open file
"x/base/1//INCREMENTAL.6229": No such file or directory
pg_combinebackup: removing output directory "xy"

So 0001 fixes this.

0002: If you try to do something like pg_combinebackup incr1 incr2 -o
result, you'll get an error saying that the first backup must be a
full backup. This is an implementation restriction that might be good
to lift, but right now that's how it is. However, if you do
pg_combinebackup full incr -o result, but the full backup happens to
contain an INCREMENTAL.* file that also exists in the incremental
backup, then you won't get an error. Instead you'll reconstruct a
completely bogus full file and write it to the result directory. Now,
this should really be impossible unless you're intentionally trying to
break pg_combinebackup, but it's also pretty lame, so 0002 fixes
things so that you get a proper error, and also adds a test case.

Review appreciated. My plan is to commit at least to master and
possibly back-patch. Opinions on whether to back-patch are also
appreciated.

Thanks,

--
Robert Haas
EDB: http://www.enterprisedb.com

Attachment Content-Type Size
v1-0001-pg_combinebackup-When-reconstructing-avoid-double.patch application/octet-stream 2.5 KB
v1-0002-pg_combinebackup-Error-if-incremental-file-exists.patch application/octet-stream 4.4 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2024-10-30 19:54:20 Re: Shave a few cycles off our ilog10 implementation
Previous Message Jelte Fennema-Nio 2024-10-30 19:49:54 Re: protocol-level wait-for-LSN