Skip to content

Commit 9cd28c2

Browse files
committed
Remove server support for old BASE_BACKUP command syntax.
Commit 0ba281c 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
1 parent 6d503d2 commit 9cd28c2

File tree

3 files changed

+4
-114
lines changed

3 files changed

+4
-114
lines changed

doc/src/sgml/protocol.sgml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3041,17 +3041,6 @@ The commands accepted in replication mode are:
30413041
</para>
30423042
</listitem>
30433043
</varlistentry>
3044-
3045-
<varlistentry>
3046-
<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> ]
3047-
</term>
3048-
<listitem>
3049-
<para>
3050-
For compatibility with older releases, this alternative syntax for
3051-
the <literal>BASE_BACKUP</literal> command is still supported.
3052-
</para>
3053-
</listitem>
3054-
</varlistentry>
30553044
</variablelist>
30563045

30573046
</para>

src/backend/replication/repl_gram.y

Lines changed: 4 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,7 @@ Node *replication_parse_result;
6767
%token K_CREATE_REPLICATION_SLOT
6868
%token K_DROP_REPLICATION_SLOT
6969
%token K_TIMELINE_HISTORY
70-
%token K_LABEL
71-
%token K_PROGRESS
72-
%token K_FAST
7370
%token K_WAIT
74-
%token K_NOWAIT
75-
%token K_MAX_RATE
76-
%token K_WAL
77-
%token K_TABLESPACE_MAP
78-
%token K_NOVERIFY_CHECKSUMS
7971
%token K_TIMELINE
8072
%token K_PHYSICAL
8173
%token K_LOGICAL
@@ -86,15 +78,13 @@ Node *replication_parse_result;
8678
%token K_EXPORT_SNAPSHOT
8779
%token K_NOEXPORT_SNAPSHOT
8880
%token K_USE_SNAPSHOT
89-
%token K_MANIFEST
90-
%token K_MANIFEST_CHECKSUMS
9181

9282
%type <node> command
9383
%type <node> base_backup start_replication start_logical_replication
9484
create_replication_slot drop_replication_slot identify_system
9585
read_replication_slot timeline_history show
96-
%type <list> base_backup_legacy_opt_list generic_option_list
97-
%type <defelt> base_backup_legacy_opt generic_option
86+
%type <list> generic_option_list
87+
%type <defelt> generic_option
9888
%type <uintval> opt_timeline
9989
%type <list> plugin_options plugin_opt_list
10090
%type <defelt> plugin_opt_elem
@@ -167,15 +157,7 @@ var_name: IDENT { $$ = $1; }
167157
;
168158

169159
/*
170-
* BASE_BACKUP ( option [ 'value' ] [, ...] )
171-
*
172-
* We also still support the legacy syntax:
173-
*
174-
* BASE_BACKUP [LABEL '<label>'] [PROGRESS] [FAST] [WAL] [NOWAIT]
175-
* [MAX_RATE %d] [TABLESPACE_MAP] [NOVERIFY_CHECKSUMS]
176-
* [MANIFEST %s] [MANIFEST_CHECKSUMS %s]
177-
*
178-
* Future options should be supported only using the new syntax.
160+
* BASE_BACKUP [ ( option [ 'value' ] [, ...] ) ]
179161
*/
180162
base_backup:
181163
K_BASE_BACKUP '(' generic_option_list ')'
@@ -184,74 +166,13 @@ base_backup:
184166
cmd->options = $3;
185167
$$ = (Node *) cmd;
186168
}
187-
| K_BASE_BACKUP base_backup_legacy_opt_list
169+
| K_BASE_BACKUP
188170
{
189171
BaseBackupCmd *cmd = makeNode(BaseBackupCmd);
190-
cmd->options = $2;
191172
$$ = (Node *) cmd;
192173
}
193174
;
194175

195-
base_backup_legacy_opt_list:
196-
base_backup_legacy_opt_list base_backup_legacy_opt
197-
{ $$ = lappend($1, $2); }
198-
| /* EMPTY */
199-
{ $$ = NIL; }
200-
;
201-
202-
base_backup_legacy_opt:
203-
K_LABEL SCONST
204-
{
205-
$$ = makeDefElem("label",
206-
(Node *)makeString($2), -1);
207-
}
208-
| K_PROGRESS
209-
{
210-
$$ = makeDefElem("progress",
211-
(Node *)makeBoolean(true), -1);
212-
}
213-
| K_FAST
214-
{
215-
$$ = makeDefElem("checkpoint",
216-
(Node *)makeString("fast"), -1);
217-
}
218-
| K_WAL
219-
{
220-
$$ = makeDefElem("wal",
221-
(Node *)makeBoolean(true), -1);
222-
}
223-
| K_NOWAIT
224-
{
225-
$$ = makeDefElem("wait",
226-
(Node *)makeBoolean(false), -1);
227-
}
228-
| K_MAX_RATE UCONST
229-
{
230-
$$ = makeDefElem("max_rate",
231-
(Node *)makeInteger($2), -1);
232-
}
233-
| K_TABLESPACE_MAP
234-
{
235-
$$ = makeDefElem("tablespace_map",
236-
(Node *)makeBoolean(true), -1);
237-
}
238-
| K_NOVERIFY_CHECKSUMS
239-
{
240-
$$ = makeDefElem("verify_checksums",
241-
(Node *)makeBoolean(false), -1);
242-
}
243-
| K_MANIFEST SCONST
244-
{
245-
$$ = makeDefElem("manifest",
246-
(Node *)makeString($2), -1);
247-
}
248-
| K_MANIFEST_CHECKSUMS SCONST
249-
{
250-
$$ = makeDefElem("manifest_checksums",
251-
(Node *)makeString($2), -1);
252-
}
253-
;
254-
255176
create_replication_slot:
256177
/* CREATE_REPLICATION_SLOT slot TEMPORARY PHYSICAL [options] */
257178
K_CREATE_REPLICATION_SLOT IDENT opt_temporary K_PHYSICAL create_slot_options
@@ -481,15 +402,7 @@ ident_or_keyword:
481402
| K_CREATE_REPLICATION_SLOT { $$ = "create_replication_slot"; }
482403
| K_DROP_REPLICATION_SLOT { $$ = "drop_replication_slot"; }
483404
| K_TIMELINE_HISTORY { $$ = "timeline_history"; }
484-
| K_LABEL { $$ = "label"; }
485-
| K_PROGRESS { $$ = "progress"; }
486-
| K_FAST { $$ = "fast"; }
487405
| K_WAIT { $$ = "wait"; }
488-
| K_NOWAIT { $$ = "nowait"; }
489-
| K_MAX_RATE { $$ = "max_rate"; }
490-
| K_WAL { $$ = "wal"; }
491-
| K_TABLESPACE_MAP { $$ = "tablespace_map"; }
492-
| K_NOVERIFY_CHECKSUMS { $$ = "noverify_checksums"; }
493406
| K_TIMELINE { $$ = "timeline"; }
494407
| K_PHYSICAL { $$ = "physical"; }
495408
| K_LOGICAL { $$ = "logical"; }
@@ -500,8 +413,6 @@ ident_or_keyword:
500413
| K_EXPORT_SNAPSHOT { $$ = "export_snapshot"; }
501414
| K_NOEXPORT_SNAPSHOT { $$ = "noexport_snapshot"; }
502415
| K_USE_SNAPSHOT { $$ = "use_snapshot"; }
503-
| K_MANIFEST { $$ = "manifest"; }
504-
| K_MANIFEST_CHECKSUMS { $$ = "manifest_checksums"; }
505416
;
506417

507418
%%

src/backend/replication/repl_scanner.l

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -108,17 +108,9 @@ identifier {ident_start}{ident_cont}*
108108
%}
109109

110110
BASE_BACKUP { return K_BASE_BACKUP; }
111-
FAST { return K_FAST; }
112111
IDENTIFY_SYSTEM { return K_IDENTIFY_SYSTEM; }
113112
READ_REPLICATION_SLOT { return K_READ_REPLICATION_SLOT; }
114113
SHOW { return K_SHOW; }
115-
LABEL { return K_LABEL; }
116-
NOWAIT { return K_NOWAIT; }
117-
PROGRESS { return K_PROGRESS; }
118-
MAX_RATE { return K_MAX_RATE; }
119-
WAL { return K_WAL; }
120-
TABLESPACE_MAP { return K_TABLESPACE_MAP; }
121-
NOVERIFY_CHECKSUMS { return K_NOVERIFY_CHECKSUMS; }
122114
TIMELINE { return K_TIMELINE; }
123115
START_REPLICATION { return K_START_REPLICATION; }
124116
CREATE_REPLICATION_SLOT { return K_CREATE_REPLICATION_SLOT; }
@@ -134,8 +126,6 @@ EXPORT_SNAPSHOT { return K_EXPORT_SNAPSHOT; }
134126
NOEXPORT_SNAPSHOT { return K_NOEXPORT_SNAPSHOT; }
135127
USE_SNAPSHOT { return K_USE_SNAPSHOT; }
136128
WAIT { return K_WAIT; }
137-
MANIFEST { return K_MANIFEST; }
138-
MANIFEST_CHECKSUMS { return K_MANIFEST_CHECKSUMS; }
139129

140130
{space}+ { /* do nothing */ }
141131

0 commit comments

Comments
 (0)