Skip to content

Commit 9588622

Browse files
committed
Fix some thinkos with pg_receivewal --compression-method
The option name was incorrect in one of the error messages, and the short option 'I' was used in the code but we did not intend things to be this way. While on it, fix the documentation to refer to a "method", and not a "level. Oversights in commit d62bcc8, that I have detected after more review of the LZ4 patch for pg_receivewal.
1 parent d62bcc8 commit 9588622

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

doc/src/sgml/ref/pg_receivewal.sgml

+1-1
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ PostgreSQL documentation
264264
</varlistentry>
265265

266266
<varlistentry>
267-
<term><option>--compression-method=<replaceable class="parameter">level</replaceable></option></term>
267+
<term><option>--compression-method=<replaceable class="parameter">method</replaceable></option></term>
268268
<listitem>
269269
<para>
270270
Enables compression of write-ahead logs using the specified method.

src/bin/pg_basebackup/pg_receivewal.c

+13-13
Original file line numberDiff line numberDiff line change
@@ -540,14 +540,14 @@ main(int argc, char **argv)
540540
{"status-interval", required_argument, NULL, 's'},
541541
{"slot", required_argument, NULL, 'S'},
542542
{"verbose", no_argument, NULL, 'v'},
543-
{"compression-method", required_argument, NULL, 'I'},
544543
{"compress", required_argument, NULL, 'Z'},
545544
/* action */
546545
{"create-slot", no_argument, NULL, 1},
547546
{"drop-slot", no_argument, NULL, 2},
548547
{"if-not-exists", no_argument, NULL, 3},
549548
{"synchronous", no_argument, NULL, 4},
550549
{"no-sync", no_argument, NULL, 5},
550+
{"compression-method", required_argument, NULL, 6},
551551
{NULL, 0, NULL, 0}
552552
};
553553

@@ -626,18 +626,6 @@ main(int argc, char **argv)
626626
case 'v':
627627
verbose++;
628628
break;
629-
case 'I':
630-
if (pg_strcasecmp(optarg, "gzip") == 0)
631-
compression_method = COMPRESSION_GZIP;
632-
else if (pg_strcasecmp(optarg, "none") == 0)
633-
compression_method = COMPRESSION_NONE;
634-
else
635-
{
636-
pg_log_error("invalid value \"%s\" for option %s",
637-
optarg, "--compress-method");
638-
exit(1);
639-
}
640-
break;
641629
case 'Z':
642630
if (!option_parse_int(optarg, "-Z/--compress", 1, 9,
643631
&compresslevel))
@@ -659,6 +647,18 @@ main(int argc, char **argv)
659647
case 5:
660648
do_sync = false;
661649
break;
650+
case 6:
651+
if (pg_strcasecmp(optarg, "gzip") == 0)
652+
compression_method = COMPRESSION_GZIP;
653+
else if (pg_strcasecmp(optarg, "none") == 0)
654+
compression_method = COMPRESSION_NONE;
655+
else
656+
{
657+
pg_log_error("invalid value \"%s\" for option %s",
658+
optarg, "--compression-method");
659+
exit(1);
660+
}
661+
break;
662662
default:
663663

664664
/*

0 commit comments

Comments
 (0)