Remove server support for old BASE_BACKUP command syntax.

Commit 0ba281cb4bf9f5f65529dfa4c8282abb734dd454 added a new syntax
for the BASE_BACKUP command, with extensible options, but maintained
support for the legacy syntax. This isn't important for PostgreSQL,
where pg_basebackup works with older server versions but not newer
ones, but it could in theory matter for out-of-core users of the
replication protocol.

Discussion on pgsql-hackers, however, suggests that no one is aware
of any out-of-core use of the BASE_BACKUP command, and the consensus
is in favor of removing support for the old syntax to simplify the
code, so do that.

Discussion: http://postgr.es/m/CA+TgmoazKcKUWtqVa0xZqSzbKgTH+X-aw4V7GyLD68EpDLMh8A@mail.gmail.com
This commit is contained in:
Robert Haas 2022-02-08 10:53:59 -05:00
parent 6d503d2a47
commit 9cd28c2e5f
3 changed files with 4 additions and 114 deletions

View File

@ -3041,17 +3041,6 @@ The commands accepted in replication mode are:
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>BASE_BACKUP</literal> [ <literal>LABEL</literal> <replaceable>'label'</replaceable> ] [ <literal>PROGRESS</literal> ] [ <literal>FAST</literal> ] [ <literal>WAL</literal> ] [ <literal>NOWAIT</literal> ] [ <literal>MAX_RATE</literal> <replaceable>rate</replaceable> ] [ <literal>TABLESPACE_MAP</literal> ] [ <literal>NOVERIFY_CHECKSUMS</literal> ] [ <literal>MANIFEST</literal> <replaceable>manifest_option</replaceable> ] [ <literal>MANIFEST_CHECKSUMS</literal> <replaceable>checksum_algorithm</replaceable> ]
</term>
<listitem>
<para>
For compatibility with older releases, this alternative syntax for
the <literal>BASE_BACKUP</literal> command is still supported.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>

View File

@ -67,15 +67,7 @@ Node *replication_parse_result;
%token K_CREATE_REPLICATION_SLOT
%token K_DROP_REPLICATION_SLOT
%token K_TIMELINE_HISTORY
%token K_LABEL
%token K_PROGRESS
%token K_FAST
%token K_WAIT
%token K_NOWAIT
%token K_MAX_RATE
%token K_WAL
%token K_TABLESPACE_MAP
%token K_NOVERIFY_CHECKSUMS
%token K_TIMELINE
%token K_PHYSICAL
%token K_LOGICAL
@ -86,15 +78,13 @@ Node *replication_parse_result;
%token K_EXPORT_SNAPSHOT
%token K_NOEXPORT_SNAPSHOT
%token K_USE_SNAPSHOT
%token K_MANIFEST
%token K_MANIFEST_CHECKSUMS
%type <node> command
%type <node> base_backup start_replication start_logical_replication
create_replication_slot drop_replication_slot identify_system
read_replication_slot timeline_history show
%type <list> base_backup_legacy_opt_list generic_option_list
%type <defelt> base_backup_legacy_opt generic_option
%type <list> generic_option_list
%type <defelt> generic_option
%type <uintval> opt_timeline
%type <list> plugin_options plugin_opt_list
%type <defelt> plugin_opt_elem
@ -167,15 +157,7 @@ var_name: IDENT { $$ = $1; }
;
/*
* BASE_BACKUP ( option [ 'value' ] [, ...] )
*
* We also still support the legacy syntax:
*
* BASE_BACKUP [LABEL '<label>'] [PROGRESS] [FAST] [WAL] [NOWAIT]
* [MAX_RATE %d] [TABLESPACE_MAP] [NOVERIFY_CHECKSUMS]
* [MANIFEST %s] [MANIFEST_CHECKSUMS %s]
*
* Future options should be supported only using the new syntax.
* BASE_BACKUP [ ( option [ 'value' ] [, ...] ) ]
*/
base_backup:
K_BASE_BACKUP '(' generic_option_list ')'
@ -184,74 +166,13 @@ base_backup:
cmd->options = $3;
$$ = (Node *) cmd;
}
| K_BASE_BACKUP base_backup_legacy_opt_list
| K_BASE_BACKUP
{
BaseBackupCmd *cmd = makeNode(BaseBackupCmd);
cmd->options = $2;
$$ = (Node *) cmd;
}
;
base_backup_legacy_opt_list:
base_backup_legacy_opt_list base_backup_legacy_opt
{ $$ = lappend($1, $2); }
| /* EMPTY */
{ $$ = NIL; }
;
base_backup_legacy_opt:
K_LABEL SCONST
{
$$ = makeDefElem("label",
(Node *)makeString($2), -1);
}
| K_PROGRESS
{
$$ = makeDefElem("progress",
(Node *)makeBoolean(true), -1);
}
| K_FAST
{
$$ = makeDefElem("checkpoint",
(Node *)makeString("fast"), -1);
}
| K_WAL
{
$$ = makeDefElem("wal",
(Node *)makeBoolean(true), -1);
}
| K_NOWAIT
{
$$ = makeDefElem("wait",
(Node *)makeBoolean(false), -1);
}
| K_MAX_RATE UCONST
{
$$ = makeDefElem("max_rate",
(Node *)makeInteger($2), -1);
}
| K_TABLESPACE_MAP
{
$$ = makeDefElem("tablespace_map",
(Node *)makeBoolean(true), -1);
}
| K_NOVERIFY_CHECKSUMS
{
$$ = makeDefElem("verify_checksums",
(Node *)makeBoolean(false), -1);
}
| K_MANIFEST SCONST
{
$$ = makeDefElem("manifest",
(Node *)makeString($2), -1);
}
| K_MANIFEST_CHECKSUMS SCONST
{
$$ = makeDefElem("manifest_checksums",
(Node *)makeString($2), -1);
}
;
create_replication_slot:
/* CREATE_REPLICATION_SLOT slot TEMPORARY PHYSICAL [options] */
K_CREATE_REPLICATION_SLOT IDENT opt_temporary K_PHYSICAL create_slot_options
@ -481,15 +402,7 @@ ident_or_keyword:
| K_CREATE_REPLICATION_SLOT { $$ = "create_replication_slot"; }
| K_DROP_REPLICATION_SLOT { $$ = "drop_replication_slot"; }
| K_TIMELINE_HISTORY { $$ = "timeline_history"; }
| K_LABEL { $$ = "label"; }
| K_PROGRESS { $$ = "progress"; }
| K_FAST { $$ = "fast"; }
| K_WAIT { $$ = "wait"; }
| K_NOWAIT { $$ = "nowait"; }
| K_MAX_RATE { $$ = "max_rate"; }
| K_WAL { $$ = "wal"; }
| K_TABLESPACE_MAP { $$ = "tablespace_map"; }
| K_NOVERIFY_CHECKSUMS { $$ = "noverify_checksums"; }
| K_TIMELINE { $$ = "timeline"; }
| K_PHYSICAL { $$ = "physical"; }
| K_LOGICAL { $$ = "logical"; }
@ -500,8 +413,6 @@ ident_or_keyword:
| K_EXPORT_SNAPSHOT { $$ = "export_snapshot"; }
| K_NOEXPORT_SNAPSHOT { $$ = "noexport_snapshot"; }
| K_USE_SNAPSHOT { $$ = "use_snapshot"; }
| K_MANIFEST { $$ = "manifest"; }
| K_MANIFEST_CHECKSUMS { $$ = "manifest_checksums"; }
;
%%

View File

@ -108,17 +108,9 @@ identifier {ident_start}{ident_cont}*
%}
BASE_BACKUP { return K_BASE_BACKUP; }
FAST { return K_FAST; }
IDENTIFY_SYSTEM { return K_IDENTIFY_SYSTEM; }
READ_REPLICATION_SLOT { return K_READ_REPLICATION_SLOT; }
SHOW { return K_SHOW; }
LABEL { return K_LABEL; }
NOWAIT { return K_NOWAIT; }
PROGRESS { return K_PROGRESS; }
MAX_RATE { return K_MAX_RATE; }
WAL { return K_WAL; }
TABLESPACE_MAP { return K_TABLESPACE_MAP; }
NOVERIFY_CHECKSUMS { return K_NOVERIFY_CHECKSUMS; }
TIMELINE { return K_TIMELINE; }
START_REPLICATION { return K_START_REPLICATION; }
CREATE_REPLICATION_SLOT { return K_CREATE_REPLICATION_SLOT; }
@ -134,8 +126,6 @@ EXPORT_SNAPSHOT { return K_EXPORT_SNAPSHOT; }
NOEXPORT_SNAPSHOT { return K_NOEXPORT_SNAPSHOT; }
USE_SNAPSHOT { return K_USE_SNAPSHOT; }
WAIT { return K_WAIT; }
MANIFEST { return K_MANIFEST; }
MANIFEST_CHECKSUMS { return K_MANIFEST_CHECKSUMS; }
{space}+ { /* do nothing */ }