Skip to content

Commit 9af34cd

Browse files
committed
Revert behaviour of -x/--xlog to 9.1 semantics
To replace it, add -X/--xlog-method that allows the specification of fetch or stream. Do this to avoid unnecessary backwards-incompatiblity. Spotted and suggested by Peter Eisentraut.
1 parent 927d61e commit 9af34cd

File tree

2 files changed

+38
-6
lines changed

2 files changed

+38
-6
lines changed

doc/src/sgml/ref/pg_basebackup.sgml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,8 @@ PostgreSQL documentation
186186
</varlistentry>
187187

188188
<varlistentry>
189-
<term><option>-x <replaceable class="parameter">method</replaceable></option></term>
190-
<term><option>--xlog=<replaceable class="parameter">method</replaceable></option></term>
189+
<term><option>-X <replaceable class="parameter">method</replaceable></option></term>
190+
<term><option>--xlog-method=<replaceable class="parameter">method</replaceable></option></term>
191191
<listitem>
192192
<para>
193193
Includes the required transaction log files (WAL files) in the
@@ -237,6 +237,17 @@ PostgreSQL documentation
237237
</listitem>
238238
</varlistentry>
239239

240+
<varlistentry>
241+
<term><option>-x</option></term>
242+
<term><option>--xlog</option></term>
243+
<listitem>
244+
<para>
245+
Using this option is equivalent of using <literal>-X</literal> with
246+
method <literal>fetch</literal>.
247+
</para>
248+
</listitem>
249+
</varlistentry>
250+
240251
<varlistentry>
241252
<term><option>-z</option></term>
242253
<term><option>--gzip</option></term>

src/bin/pg_basebackup/pg_basebackup.c

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,9 @@ usage(void)
107107
printf(_("\nOptions controlling the output:\n"));
108108
printf(_(" -D, --pgdata=DIRECTORY receive base backup into directory\n"));
109109
printf(_(" -F, --format=p|t output format (plain (default), tar)\n"));
110-
printf(_(" -x, --xlog=fetch|stream include required WAL files in backup\n"));
110+
printf(_(" -x, --xlog include required WAL files in backup (fetch mode)\n"));
111+
printf(_(" -X, --xlog-method=fetch|stream\n"
112+
" include required WAL files with specified method\n"));
111113
printf(_(" -z, --gzip compress tar output\n"));
112114
printf(_(" -Z, --compress=0-9 compress tar output with given compression level\n"));
113115
printf(_("\nGeneral options:\n"));
@@ -1194,7 +1196,8 @@ main(int argc, char **argv)
11941196
{"pgdata", required_argument, NULL, 'D'},
11951197
{"format", required_argument, NULL, 'F'},
11961198
{"checkpoint", required_argument, NULL, 'c'},
1197-
{"xlog", required_argument, NULL, 'x'},
1199+
{"xlog", no_argument, NULL, 'x'},
1200+
{"xlog-method", required_argument, NULL, 'X'},
11981201
{"gzip", no_argument, NULL, 'z'},
11991202
{"compress", required_argument, NULL, 'Z'},
12001203
{"label", required_argument, NULL, 'l'},
@@ -1230,7 +1233,7 @@ main(int argc, char **argv)
12301233
}
12311234
}
12321235

1233-
while ((c = getopt_long(argc, argv, "D:F:x:l:zZ:c:h:p:U:s:wWvP",
1236+
while ((c = getopt_long(argc, argv, "D:F:xX:l:zZ:c:h:p:U:s:wWvP",
12341237
long_options, &option_index)) != -1)
12351238
{
12361239
switch (c)
@@ -1251,6 +1254,24 @@ main(int argc, char **argv)
12511254
}
12521255
break;
12531256
case 'x':
1257+
if (includewal)
1258+
{
1259+
fprintf(stderr, _("%s: cannot specify both --xlog and --xlog-method\n"),
1260+
progname);
1261+
exit(1);
1262+
}
1263+
1264+
includewal = true;
1265+
streamwal = false;
1266+
break;
1267+
case 'X':
1268+
if (includewal)
1269+
{
1270+
fprintf(stderr, _("%s: cannot specify both --xlog and --xlog-method\n"),
1271+
progname);
1272+
exit(1);
1273+
}
1274+
12541275
includewal = true;
12551276
if (strcmp(optarg, "f") == 0 ||
12561277
strcmp(optarg, "fetch") == 0)
@@ -1260,7 +1281,7 @@ main(int argc, char **argv)
12601281
streamwal = true;
12611282
else
12621283
{
1263-
fprintf(stderr, _("%s: invalid xlog option \"%s\", must be empty, \"fetch\", or \"stream\"\n"),
1284+
fprintf(stderr, _("%s: invalid xlog-method option \"%s\", must be empty, \"fetch\", or \"stream\"\n"),
12641285
progname, optarg);
12651286
exit(1);
12661287
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy