Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Remove server support for old BASE_BACKUP command syntax.
authorRobert Haas <rhaas@postgresql.org>
Tue, 8 Feb 2022 15:53:59 +0000 (10:53 -0500)
committerRobert Haas <rhaas@postgresql.org>
Thu, 10 Feb 2022 15:48:33 +0000 (10:48 -0500)
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

doc/src/sgml/protocol.sgml
src/backend/replication/repl_gram.y
src/backend/replication/repl_scanner.l

index 24e93f9b28476d6424382be3cdbcba78dc940571..71f746e891fec5ef3aa707cf176b635d594b416c 100644 (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>
index 3b92180e8cbf3f576a44f70029efd7e53ef88dee..ee0c0774ea39c8359e7d706dfaa5467d5724888e 100644 (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"; }
        ;
 
 %%
index d992bcc2e3c04dea755cb12239e2d4790f0c70cd..4b64c0d768bf04333c7908a1dea55b272af829c3 100644 (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 */ }