repl_grammar.patch
application/octet-stream
Filename: repl_grammar.patch
Type: application/octet-stream
Part: 0
Message:
Re: WIP/PoC for parallel backup
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: unified
| File | + | − |
|---|---|---|
| src/backend/replication/repl_gram.y | 143 | 54 |
diff --git a/src/backend/replication/repl_gram.y b/src/backend/replication/repl_gram.y
index 5619837ebe..f94961132e 100644
--- a/src/backend/replication/repl_gram.y
+++ b/src/backend/replication/repl_gram.y
@@ -99,7 +99,13 @@ static SQLCmd *make_sqlcmd(void);
create_replication_slot drop_replication_slot identify_system
timeline_history show sql_cmd
%type <list> base_backup_opt_list
+ start_backup_opt_list stop_backup_opt_list
+ send_backup_files_opt_list send_backup_filelist
%type <defelt> base_backup_opt
+ backup_opt_label backup_opt_progress backup_opt_maxrate
+ backup_opt_fast backup_opt_tsmap backup_opt_wal backup_opt_nowait
+ backup_opt_chksum backup_opt_wal_loc backup_opt_tspath
+ start_backup_opt stop_backup_opt send_backup_filelist_opt send_backup_files_opt
%type <uintval> opt_timeline
%type <list> plugin_options plugin_opt_list
%type <defelt> plugin_opt_elem
@@ -173,21 +179,21 @@ base_backup:
cmd->cmdtag = BASE_BACKUP;
$$ = (Node *) cmd;
}
- | K_START_BACKUP base_backup_opt_list
+ | K_START_BACKUP start_backup_opt_list
{
BaseBackupCmd *cmd = makeNode(BaseBackupCmd);
cmd->options = $2;
cmd->cmdtag = START_BACKUP;
$$ = (Node *) cmd;
}
- | K_SEND_BACKUP_FILELIST base_backup_opt_list
+ | K_SEND_BACKUP_FILELIST send_backup_filelist
{
BaseBackupCmd *cmd = makeNode(BaseBackupCmd);
cmd->options = $2;
cmd->cmdtag = SEND_BACKUP_FILELIST;
$$ = (Node *) cmd;
}
- | K_SEND_BACKUP_FILES backup_files base_backup_opt_list
+ | K_SEND_BACKUP_FILES backup_files send_backup_files_opt_list
{
BaseBackupCmd *cmd = makeNode(BaseBackupCmd);
cmd->options = $3;
@@ -195,7 +201,7 @@ base_backup:
cmd->backupfiles = $2;
$$ = (Node *) cmd;
}
- | K_STOP_BACKUP base_backup_opt_list
+ | K_STOP_BACKUP stop_backup_opt_list
{
BaseBackupCmd *cmd = makeNode(BaseBackupCmd);
cmd->options = $2;
@@ -204,6 +210,34 @@ base_backup:
}
;
+start_backup_opt_list:
+ start_backup_opt_list start_backup_opt
+ { $$ = lappend($1, $2); }
+ | /* EMPTY */
+ { $$ = NIL; }
+ ;
+
+stop_backup_opt_list:
+ stop_backup_opt_list stop_backup_opt
+ { $$ = lappend($1, $2); }
+ | /* EMPTY */
+ { $$ = NIL; }
+ ;
+
+send_backup_filelist:
+ send_backup_filelist send_backup_filelist_opt
+ { $$ = lappend($1, $2); }
+ | /* EMPTY */
+ { $$ = NIL; }
+ ;
+
+send_backup_files_opt_list:
+ send_backup_files_opt_list send_backup_files_opt
+ { $$ = lappend($1, $2); }
+ | /* EMPTY */
+ { $$ = NIL; }
+ ;
+
base_backup_opt_list:
base_backup_opt_list base_backup_opt
{ $$ = lappend($1, $2); }
@@ -211,59 +245,114 @@ base_backup_opt_list:
{ $$ = NIL; }
;
+start_backup_opt:
+ backup_opt_label { $$ = $1; }
+ | backup_opt_maxrate { $$ = $1; }
+ | backup_opt_progress { $$ = $1; }
+ | backup_opt_tsmap { $$ = $1; }
+ ;
+
+stop_backup_opt:
+ backup_opt_label { $$ = $1; }
+ | backup_opt_maxrate { $$ = $1; }
+ | backup_opt_wal { $$ = $1; }
+ | backup_opt_nowait { $$ = $1; }
+ ;
+
+send_backup_filelist_opt:
+ backup_opt_tsmap { $$ = $1; }
+ ;
+
+send_backup_files_opt:
+ backup_opt_maxrate { $$ = $1; }
+ | backup_opt_chksum { $$ = $1; }
+ | backup_opt_wal_loc { $$ = $1; }
+ | backup_opt_tspath { $$ = $1; }
+ ;
+
base_backup_opt:
- K_LABEL SCONST
- {
- $$ = makeDefElem("label",
- (Node *)makeString($2), -1);
- }
- | K_PROGRESS
- {
- $$ = makeDefElem("progress",
- (Node *)makeInteger(true), -1);
- }
- | K_FAST
- {
- $$ = makeDefElem("fast",
- (Node *)makeInteger(true), -1);
- }
- | K_WAL
- {
- $$ = makeDefElem("wal",
- (Node *)makeInteger(true), -1);
- }
- | K_NOWAIT
- {
- $$ = makeDefElem("nowait",
- (Node *)makeInteger(true), -1);
- }
- | K_MAX_RATE UCONST
- {
- $$ = makeDefElem("max_rate",
- (Node *)makeInteger($2), -1);
- }
- | K_TABLESPACE_MAP
- {
- $$ = makeDefElem("tablespace_map",
- (Node *)makeInteger(true), -1);
- }
- | K_NOVERIFY_CHECKSUMS
- {
- $$ = makeDefElem("noverify_checksums",
- (Node *)makeInteger(true), -1);
- }
- | K_START_WAL_LOCATION SCONST
- {
- $$ = makeDefElem("start_wal_location",
- (Node *)makeString($2), -1);
- }
- | K_TABLESPACE_PATH SCONST
- {
- $$ = makeDefElem("tablespace_path",
- (Node *)makeString($2), -1);
- }
+ backup_opt_label { $$ = $1; }
+ | backup_opt_maxrate { $$ = $1; }
+ | backup_opt_fast { $$ = $1; }
+ | backup_opt_progress { $$ = $1; }
+ | backup_opt_tsmap { $$ = $1; }
+ | backup_opt_wal { $$ = $1; }
+ | backup_opt_nowait { $$ = $1; }
+ | backup_opt_chksum { $$ = $1; }
+ | backup_opt_wal_loc { $$ = $1; }
+ | backup_opt_tspath { $$ = $1; }
;
+backup_opt_label:
+ K_LABEL SCONST
+ {
+ $$ = makeDefElem("label",
+ (Node *)makeString($2), -1);
+ };
+
+backup_opt_progress:
+ K_PROGRESS
+ {
+ $$ = makeDefElem("progress",
+ (Node *)makeInteger(true), -1);
+ };
+
+backup_opt_fast:
+ K_FAST
+ {
+ $$ = makeDefElem("fast",
+ (Node *)makeInteger(true), -1);
+ };
+
+backup_opt_wal:
+ K_WAL
+ {
+ $$ = makeDefElem("wal",
+ (Node *)makeInteger(true), -1);
+ };
+
+backup_opt_nowait:
+ K_NOWAIT
+ {
+ $$ = makeDefElem("nowait",
+ (Node *)makeInteger(true), -1);
+ };
+
+backup_opt_maxrate:
+ K_MAX_RATE UCONST
+ {
+ $$ = makeDefElem("max_rate",
+ (Node *)makeInteger($2), -1);
+ };
+
+backup_opt_tsmap:
+ K_TABLESPACE_MAP
+ {
+ $$ = makeDefElem("tablespace_map",
+ (Node *)makeInteger(true), -1);
+ };
+
+backup_opt_chksum:
+ K_NOVERIFY_CHECKSUMS
+ {
+ $$ = makeDefElem("noverify_checksums",
+ (Node *)makeInteger(true), -1);
+ };
+
+backup_opt_wal_loc:
+ K_START_WAL_LOCATION SCONST
+ {
+ $$ = makeDefElem("start_wal_location",
+ (Node *)makeString($2), -1);
+ };
+
+backup_opt_tspath:
+ K_TABLESPACE_PATH SCONST
+ {
+ $$ = makeDefElem("tablespace_path",
+ (Node *)makeString($2), -1);
+ };
+
backup_files:
'(' backup_files_list ')'
{