mirror of
https://github.com/postgres/postgres.git
synced 2025-07-03 20:02:46 +03:00
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 (commitcf2655a902
), so no compatibility break there. The option --two-phase has existed since PostgreSQL 15 (commitcda03cfed6
), 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
This commit is contained in:
@ -169,7 +169,7 @@ COMMIT 693
|
|||||||
$ pg_recvlogical -d postgres --slot=test --drop-slot
|
$ pg_recvlogical -d postgres --slot=test --drop-slot
|
||||||
|
|
||||||
Example 2:
|
Example 2:
|
||||||
$ pg_recvlogical -d postgres --slot=test --create-slot --two-phase
|
$ pg_recvlogical -d postgres --slot=test --create-slot --enable-two-phase
|
||||||
$ pg_recvlogical -d postgres --slot=test --start -f -
|
$ pg_recvlogical -d postgres --slot=test --start -f -
|
||||||
<keycombo action="simul"><keycap>Control</keycap><keycap>Z</keycap></keycombo>
|
<keycombo action="simul"><keycap>Control</keycap><keycap>Z</keycap></keycombo>
|
||||||
$ psql -d postgres -c "BEGIN;INSERT INTO data(data) VALUES('5');PREPARE TRANSACTION 'test';"
|
$ psql -d postgres -c "BEGIN;INSERT INTO data(data) VALUES('5');PREPARE TRANSACTION 'test';"
|
||||||
|
@ -79,8 +79,8 @@ PostgreSQL documentation
|
|||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
The <option>--two-phase</option> and <option>--failover</option> options
|
The <option>--enable-two-phase</option> and <option>--enable-failover</option>
|
||||||
can be specified with <option>--create-slot</option>.
|
options can be specified with <option>--create-slot</option>.
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
@ -166,7 +166,7 @@ PostgreSQL documentation
|
|||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><option>--failover</option></term>
|
<term><option>--enable-failover</option></term>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>
|
<para>
|
||||||
Enables the slot to be synchronized to the standbys. This option may
|
Enables the slot to be synchronized to the standbys. This option may
|
||||||
@ -300,7 +300,8 @@ PostgreSQL documentation
|
|||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><option>-t</option></term>
|
<term><option>-t</option></term>
|
||||||
<term><option>--two-phase</option></term>
|
<term><option>--enable-two-phase</option></term>
|
||||||
|
<term><option>--two-phase</option> (deprecated)</term>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>
|
<para>
|
||||||
Enables decoding of prepared transactions. This option may only be specified with
|
Enables decoding of prepared transactions. This option may only be specified with
|
||||||
|
@ -41,8 +41,8 @@ typedef enum
|
|||||||
/* Global Options */
|
/* Global Options */
|
||||||
static char *outfile = NULL;
|
static char *outfile = NULL;
|
||||||
static int verbose = 0;
|
static int verbose = 0;
|
||||||
static bool two_phase = false;
|
static bool two_phase = false; /* enable-two-phase option */
|
||||||
static bool failover = false;
|
static bool failover = false; /* enable-failover option */
|
||||||
static int noloop = 0;
|
static int noloop = 0;
|
||||||
static int standby_message_timeout = 10 * 1000; /* 10 sec = default */
|
static int standby_message_timeout = 10 * 1000; /* 10 sec = default */
|
||||||
static int fsync_interval = 10 * 1000; /* 10 sec = default */
|
static int fsync_interval = 10 * 1000; /* 10 sec = default */
|
||||||
@ -89,9 +89,9 @@ usage(void)
|
|||||||
printf(_(" --drop-slot drop the replication slot (for the slot's name see --slot)\n"));
|
printf(_(" --drop-slot drop the replication slot (for the slot's name see --slot)\n"));
|
||||||
printf(_(" --start start streaming in a replication slot (for the slot's name see --slot)\n"));
|
printf(_(" --start start streaming in a replication slot (for the slot's name see --slot)\n"));
|
||||||
printf(_("\nOptions:\n"));
|
printf(_("\nOptions:\n"));
|
||||||
printf(_(" -E, --endpos=LSN exit after receiving the specified LSN\n"));
|
printf(_(" --enable-failover enable replication slot synchronization to standby servers when\n"
|
||||||
printf(_(" --failover enable replication slot synchronization to standby servers when\n"
|
|
||||||
" creating a replication slot\n"));
|
" creating a replication slot\n"));
|
||||||
|
printf(_(" -E, --endpos=LSN exit after receiving the specified LSN\n"));
|
||||||
printf(_(" -f, --file=FILE receive log into this file, - for stdout\n"));
|
printf(_(" -f, --file=FILE receive log into this file, - for stdout\n"));
|
||||||
printf(_(" -F --fsync-interval=SECS\n"
|
printf(_(" -F --fsync-interval=SECS\n"
|
||||||
" time between fsyncs to the output file (default: %d)\n"), (fsync_interval / 1000));
|
" time between fsyncs to the output file (default: %d)\n"), (fsync_interval / 1000));
|
||||||
@ -105,7 +105,8 @@ usage(void)
|
|||||||
printf(_(" -s, --status-interval=SECS\n"
|
printf(_(" -s, --status-interval=SECS\n"
|
||||||
" time between status packets sent to server (default: %d)\n"), (standby_message_timeout / 1000));
|
" time between status packets sent to server (default: %d)\n"), (standby_message_timeout / 1000));
|
||||||
printf(_(" -S, --slot=SLOTNAME name of the logical replication slot\n"));
|
printf(_(" -S, --slot=SLOTNAME name of the logical replication slot\n"));
|
||||||
printf(_(" -t, --two-phase enable decoding of prepared transactions when creating a slot\n"));
|
printf(_(" -t, --enable-two-phase enable decoding of prepared transactions when creating a slot\n"));
|
||||||
|
printf(_(" --two-phase (same as --enable-two-phase, deprecated)\n"));
|
||||||
printf(_(" -v, --verbose output verbose messages\n"));
|
printf(_(" -v, --verbose output verbose messages\n"));
|
||||||
printf(_(" -V, --version output version information, then exit\n"));
|
printf(_(" -V, --version output version information, then exit\n"));
|
||||||
printf(_(" -?, --help show this help, then exit\n"));
|
printf(_(" -?, --help show this help, then exit\n"));
|
||||||
@ -698,9 +699,10 @@ main(int argc, char **argv)
|
|||||||
{"file", required_argument, NULL, 'f'},
|
{"file", required_argument, NULL, 'f'},
|
||||||
{"fsync-interval", required_argument, NULL, 'F'},
|
{"fsync-interval", required_argument, NULL, 'F'},
|
||||||
{"no-loop", no_argument, NULL, 'n'},
|
{"no-loop", no_argument, NULL, 'n'},
|
||||||
{"failover", no_argument, NULL, 5},
|
{"enable-failover", no_argument, NULL, 5},
|
||||||
|
{"enable-two-phase", no_argument, NULL, 't'},
|
||||||
|
{"two-phase", no_argument, NULL, 't'}, /* deprecated */
|
||||||
{"verbose", no_argument, NULL, 'v'},
|
{"verbose", no_argument, NULL, 'v'},
|
||||||
{"two-phase", no_argument, NULL, 't'},
|
|
||||||
{"version", no_argument, NULL, 'V'},
|
{"version", no_argument, NULL, 'V'},
|
||||||
{"help", no_argument, NULL, '?'},
|
{"help", no_argument, NULL, '?'},
|
||||||
/* connection options */
|
/* connection options */
|
||||||
@ -928,14 +930,14 @@ main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
if (two_phase)
|
if (two_phase)
|
||||||
{
|
{
|
||||||
pg_log_error("--two-phase may only be specified with --create-slot");
|
pg_log_error("%s may only be specified with --create-slot", "--enable-two-phase");
|
||||||
pg_log_error_hint("Try \"%s --help\" for more information.", progname);
|
pg_log_error_hint("Try \"%s --help\" for more information.", progname);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (failover)
|
if (failover)
|
||||||
{
|
{
|
||||||
pg_log_error("--failover may only be specified with --create-slot");
|
pg_log_error("%s may only be specified with --create-slot", "--enable-failover");
|
||||||
pg_log_error_hint("Try \"%s --help\" for more information.", progname);
|
pg_log_error_hint("Try \"%s --help\" for more information.", progname);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,7 @@ $node->command_fails(
|
|||||||
'--dbname' => $node->connstr('postgres'),
|
'--dbname' => $node->connstr('postgres'),
|
||||||
'--start',
|
'--start',
|
||||||
'--endpos' => $nextlsn,
|
'--endpos' => $nextlsn,
|
||||||
'--two-phase', '--no-loop',
|
'--enable-two-phase', '--no-loop',
|
||||||
'--file' => '-',
|
'--file' => '-',
|
||||||
],
|
],
|
||||||
'incorrect usage');
|
'incorrect usage');
|
||||||
@ -142,7 +142,7 @@ $node->command_ok(
|
|||||||
'--slot' => 'test',
|
'--slot' => 'test',
|
||||||
'--dbname' => $node->connstr('postgres'),
|
'--dbname' => $node->connstr('postgres'),
|
||||||
'--create-slot',
|
'--create-slot',
|
||||||
'--failover',
|
'--enable-failover',
|
||||||
],
|
],
|
||||||
'slot with failover created');
|
'slot with failover created');
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user