summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomas Vondra2024-06-30 17:20:02 +0000
committerTomas Vondra2024-06-30 18:53:31 +0000
commita9577bae6b5c88c6865597aacd33b93d1b17e497 (patch)
tree47cf590db59b89d434c2807d3e99c2eeaaba1e04
parente99e840b82756bc6858222d97453639cef929b53 (diff)
Add pg_combinebackup --copy option
Introduces --copy as an alternative to --clone and --copy-file-range. This option simply picks the default mode to copy files, as if none of the options was specified. This makes pg_combinebackup options more consistent with pg_upgrade, and it makes testing simpler. Reported-by: Peter Eisentraut Discussion: https://postgr.es/m/48da4a1f-ccd9-4988-9622-24f37b1de2b4%40eisentraut.org
-rw-r--r--doc/src/sgml/ref/pg_combinebackup.sgml10
-rw-r--r--src/bin/pg_combinebackup/pg_combinebackup.c7
2 files changed, 16 insertions, 1 deletions
diff --git a/doc/src/sgml/ref/pg_combinebackup.sgml b/doc/src/sgml/ref/pg_combinebackup.sgml
index 375307d57bd..091982f62ad 100644
--- a/doc/src/sgml/ref/pg_combinebackup.sgml
+++ b/doc/src/sgml/ref/pg_combinebackup.sgml
@@ -163,6 +163,16 @@ PostgreSQL documentation
</varlistentry>
<varlistentry>
+ <term><option>--copy</option></term>
+ <listitem>
+ <para>
+ Perform regular file copy. This is the default. (See also
+ <option>--copy-file-range</option> and <option>--clone</option>.)
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
<term><option>--copy-file-range</option></term>
<listitem>
<para>
diff --git a/src/bin/pg_combinebackup/pg_combinebackup.c b/src/bin/pg_combinebackup/pg_combinebackup.c
index 363fae234e9..986a256dea5 100644
--- a/src/bin/pg_combinebackup/pg_combinebackup.c
+++ b/src/bin/pg_combinebackup/pg_combinebackup.c
@@ -139,7 +139,8 @@ main(int argc, char *argv[])
{"no-manifest", no_argument, NULL, 2},
{"sync-method", required_argument, NULL, 3},
{"clone", no_argument, NULL, 4},
- {"copy-file-range", no_argument, NULL, 5},
+ {"copy", no_argument, NULL, 5},
+ {"copy-file-range", no_argument, NULL, 6},
{NULL, 0, NULL, 0}
};
@@ -209,6 +210,9 @@ main(int argc, char *argv[])
opt.copy_method = COPY_METHOD_CLONE;
break;
case 5:
+ opt.copy_method = COPY_METHOD_COPY;
+ break;
+ case 6:
opt.copy_method = COPY_METHOD_COPY_FILE_RANGE;
break;
default:
@@ -763,6 +767,7 @@ help(const char *progname)
printf(_(" -T, --tablespace-mapping=OLDDIR=NEWDIR\n"
" relocate tablespace in OLDDIR to NEWDIR\n"));
printf(_(" --clone clone (reflink) instead of copying files\n"));
+ printf(_(" --copy copy files (default)\n"));
printf(_(" --copy-file-range copy using copy_file_range() syscall\n"));
printf(_(" --manifest-checksums=SHA{224,256,384,512}|CRC32C|NONE\n"
" use algorithm for manifest checksums\n"));