pg_combinebackup: Error if incremental file exists in full backup.
authorRobert Haas <rhaas@postgresql.org>
Mon, 4 Nov 2024 15:11:05 +0000 (10:11 -0500)
committerRobert Haas <rhaas@postgresql.org>
Mon, 4 Nov 2024 15:19:37 +0000 (10:19 -0500)
commite367114429e09696fce01dd6f256e58a2c858734
tree6f8a928c66e4ac6ae8c627832fbe6a15477ff8f1
parent0d635b615d3fc406b0b3df0637831a799561fa77
pg_combinebackup: Error if incremental file exists in full backup.

Suppose that you run a command like "pg_combinebackup b1 b2 -o output",
but both b1 and b2 contain an INCREMENTAL.$something file in a directory
that is expected to contain relation files. This is an error, but the
previous code would not detect the problem and instead write a garbage
full file named $something to the output directory. This commit adds
code to detect the error and a test case to verify the behavior.

It's difficult to imagine that this will ever happen unless someone
is intentionally trying to break incremental backup, but per discussion,
let's consider that the lack of adequate sanity checking in this area is
a bug and back-patch to v17, where incremental backup was introduced.

Patch by me, reviewed by Bertrand Drouvot and Amul Sul.

Discussion: http://postgr.es/m/CA+TgmoaD7dBYPqe7kMtO0dyto7rd0rUh7joh=JPUSaFszKY6Pg@mail.gmail.com
src/bin/pg_combinebackup/meson.build
src/bin/pg_combinebackup/reconstruct.c
src/bin/pg_combinebackup/t/009_no_full_file.pl [new file with mode: 0644]