Skip to content

Commit 6d12d5a

Browse files
pg_recvlogical: Rename --two-phase and --failover options.
This commit renames the pg_recvlogical options --two-phase and --failover to --enable-two-phase and --enable-failover, respectively. The new names distinguish these enabling options from action options like --start and --create-slot, while clearly indicating their purpose to enable specific logical slot features. The option --failover is new in PostgreSQL 18 (commit cf2655a), so no compatibility break there. The option --two-phase has existed since PostgreSQL 15 (commit cda03cf), so for compatibility we keep the old option name --two-phase around as deprecated. Also note that pg_createsubscriber has acquired an --enable-two-phase option, so this increases consistency across tools. Co-authored-by: Masahiko Sawada <sawada.mshk@gmail.com> Discussion: https://postgr.es/m/a28f66df-1354-4709-8d63-932ded4cac35@eisentraut.org
1 parent 50fd428 commit 6d12d5a

File tree

4 files changed

+19
-16
lines changed

4 files changed

+19
-16
lines changed

doc/src/sgml/logicaldecoding.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ COMMIT 693
169169
$ pg_recvlogical -d postgres --slot=test --drop-slot
170170

171171
Example 2:
172-
$ pg_recvlogical -d postgres --slot=test --create-slot --two-phase
172+
$ pg_recvlogical -d postgres --slot=test --create-slot --enable-two-phase
173173
$ pg_recvlogical -d postgres --slot=test --start -f -
174174
<keycombo action="simul"><keycap>Control</keycap><keycap>Z</keycap></keycombo>
175175
$ psql -d postgres -c "BEGIN;INSERT INTO data(data) VALUES('5');PREPARE TRANSACTION 'test';"

doc/src/sgml/ref/pg_recvlogical.sgml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ PostgreSQL documentation
7979
</para>
8080

8181
<para>
82-
The <option>--two-phase</option> and <option>--failover</option> options
83-
can be specified with <option>--create-slot</option>.
82+
The <option>--enable-two-phase</option> and <option>--enable-failover</option>
83+
options can be specified with <option>--create-slot</option>.
8484
</para>
8585
</listitem>
8686
</varlistentry>
@@ -166,7 +166,7 @@ PostgreSQL documentation
166166
</varlistentry>
167167

168168
<varlistentry>
169-
<term><option>--failover</option></term>
169+
<term><option>--enable-failover</option></term>
170170
<listitem>
171171
<para>
172172
Enables the slot to be synchronized to the standbys. This option may
@@ -300,7 +300,8 @@ PostgreSQL documentation
300300

301301
<varlistentry>
302302
<term><option>-t</option></term>
303-
<term><option>--two-phase</option></term>
303+
<term><option>--enable-two-phase</option></term>
304+
<term><option>--two-phase</option> (deprecated)</term>
304305
<listitem>
305306
<para>
306307
Enables decoding of prepared transactions. This option may only be specified with

src/bin/pg_basebackup/pg_recvlogical.c

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ typedef enum
4141
/* Global Options */
4242
static char *outfile = NULL;
4343
static int verbose = 0;
44-
static bool two_phase = false;
45-
static bool failover = false;
44+
static bool two_phase = false; /* enable-two-phase option */
45+
static bool failover = false; /* enable-failover option */
4646
static int noloop = 0;
4747
static int standby_message_timeout = 10 * 1000; /* 10 sec = default */
4848
static int fsync_interval = 10 * 1000; /* 10 sec = default */
@@ -89,9 +89,9 @@ usage(void)
8989
printf(_(" --drop-slot drop the replication slot (for the slot's name see --slot)\n"));
9090
printf(_(" --start start streaming in a replication slot (for the slot's name see --slot)\n"));
9191
printf(_("\nOptions:\n"));
92-
printf(_(" -E, --endpos=LSN exit after receiving the specified LSN\n"));
93-
printf(_(" --failover enable replication slot synchronization to standby servers when\n"
92+
printf(_(" --enable-failover enable replication slot synchronization to standby servers when\n"
9493
" creating a replication slot\n"));
94+
printf(_(" -E, --endpos=LSN exit after receiving the specified LSN\n"));
9595
printf(_(" -f, --file=FILE receive log into this file, - for stdout\n"));
9696
printf(_(" -F --fsync-interval=SECS\n"
9797
" time between fsyncs to the output file (default: %d)\n"), (fsync_interval / 1000));
@@ -105,7 +105,8 @@ usage(void)
105105
printf(_(" -s, --status-interval=SECS\n"
106106
" time between status packets sent to server (default: %d)\n"), (standby_message_timeout / 1000));
107107
printf(_(" -S, --slot=SLOTNAME name of the logical replication slot\n"));
108-
printf(_(" -t, --two-phase enable decoding of prepared transactions when creating a slot\n"));
108+
printf(_(" -t, --enable-two-phase enable decoding of prepared transactions when creating a slot\n"));
109+
printf(_(" --two-phase (same as --enable-two-phase, deprecated)\n"));
109110
printf(_(" -v, --verbose output verbose messages\n"));
110111
printf(_(" -V, --version output version information, then exit\n"));
111112
printf(_(" -?, --help show this help, then exit\n"));
@@ -698,9 +699,10 @@ main(int argc, char **argv)
698699
{"file", required_argument, NULL, 'f'},
699700
{"fsync-interval", required_argument, NULL, 'F'},
700701
{"no-loop", no_argument, NULL, 'n'},
701-
{"failover", no_argument, NULL, 5},
702+
{"enable-failover", no_argument, NULL, 5},
703+
{"enable-two-phase", no_argument, NULL, 't'},
704+
{"two-phase", no_argument, NULL, 't'}, /* deprecated */
702705
{"verbose", no_argument, NULL, 'v'},
703-
{"two-phase", no_argument, NULL, 't'},
704706
{"version", no_argument, NULL, 'V'},
705707
{"help", no_argument, NULL, '?'},
706708
/* connection options */
@@ -928,14 +930,14 @@ main(int argc, char **argv)
928930
{
929931
if (two_phase)
930932
{
931-
pg_log_error("--two-phase may only be specified with --create-slot");
933+
pg_log_error("%s may only be specified with --create-slot", "--enable-two-phase");
932934
pg_log_error_hint("Try \"%s --help\" for more information.", progname);
933935
exit(1);
934936
}
935937

936938
if (failover)
937939
{
938-
pg_log_error("--failover may only be specified with --create-slot");
940+
pg_log_error("%s may only be specified with --create-slot", "--enable-failover");
939941
pg_log_error_hint("Try \"%s --help\" for more information.", progname);
940942
exit(1);
941943
}

src/bin/pg_basebackup/t/030_pg_recvlogical.pl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110
'--dbname' => $node->connstr('postgres'),
111111
'--start',
112112
'--endpos' => $nextlsn,
113-
'--two-phase', '--no-loop',
113+
'--enable-two-phase', '--no-loop',
114114
'--file' => '-',
115115
],
116116
'incorrect usage');
@@ -142,7 +142,7 @@
142142
'--slot' => 'test',
143143
'--dbname' => $node->connstr('postgres'),
144144
'--create-slot',
145-
'--failover',
145+
'--enable-failover',
146146
],
147147
'slot with failover created');
148148

0 commit comments

Comments
 (0)