@@ -143,7 +143,7 @@ static const CatalogId nilCatalogId = {0, 0};
143
143
static void help(const char *progname);
144
144
static void setup_connection(Archive *AH,
145
145
const char *dumpencoding, const char *dumpsnapshot,
146
- char *use_role);
146
+ char *use_role, const char* snapfs_snapshot );
147
147
static ArchiveFormat parseArchiveFormat(const char *format, ArchiveMode *mode);
148
148
static void expand_schema_name_patterns(Archive *fout,
149
149
SimpleStringList *patterns,
@@ -305,6 +305,7 @@ main(int argc, char **argv)
305
305
Archive *fout; /* the script file */
306
306
const char *dumpencoding = NULL;
307
307
const char *dumpsnapshot = NULL;
308
+ const char *snapfs_snapshot = NULL;
308
309
char *use_role = NULL;
309
310
int numWorkers = 1;
310
311
trivalue prompt_password = TRI_DEFAULT;
@@ -367,6 +368,7 @@ main(int argc, char **argv)
367
368
{"section", required_argument, NULL, 5},
368
369
{"serializable-deferrable", no_argument, &dopt.serializable_deferrable, 1},
369
370
{"snapshot", required_argument, NULL, 6},
371
+ {"snapfs-snapshot", required_argument, NULL, 8},
370
372
{"strict-names", no_argument, &strict_names, 1},
371
373
{"use-set-session-authorization", no_argument, &dopt.use_setsessauth, 1},
372
374
{"no-comments", no_argument, &dopt.no_comments, 1},
@@ -561,6 +563,10 @@ main(int argc, char **argv)
561
563
dosync = false;
562
564
break;
563
565
566
+ case 8: /* snapfs-snapshot */
567
+ snapfs_snapshot = pg_strdup(optarg);
568
+ break;
569
+
564
570
default:
565
571
fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname);
566
572
exit_nicely(1);
@@ -696,7 +702,7 @@ main(int argc, char **argv)
696
702
* death.
697
703
*/
698
704
ConnectDatabase(fout, dopt.dbname, dopt.pghost, dopt.pgport, dopt.username, prompt_password);
699
- setup_connection(fout, dumpencoding, dumpsnapshot, use_role);
705
+ setup_connection(fout, dumpencoding, dumpsnapshot, use_role, snapfs_snapshot );
700
706
701
707
/*
702
708
* Disable security label support if server version < v9.1.x (prevents
@@ -996,6 +1002,7 @@ help(const char *progname)
996
1002
printf(_(" --section=SECTION dump named section (pre-data, data, or post-data)\n"));
997
1003
printf(_(" --serializable-deferrable wait until the dump can run without anomalies\n"));
998
1004
printf(_(" --snapshot=SNAPSHOT use given snapshot for the dump\n"));
1005
+ printf(_(" --snapfs-snapshot=SNAPSHOT use given SNAPFS snapshot for the dump\n"));
999
1006
printf(_(" --strict-names require table and/or schema include patterns to\n"
1000
1007
" match at least one entity each\n"));
1001
1008
printf(_(" --use-set-session-authorization\n"
@@ -1018,7 +1025,7 @@ help(const char *progname)
1018
1025
1019
1026
static void
1020
1027
setup_connection(Archive *AH, const char *dumpencoding,
1021
- const char *dumpsnapshot, char *use_role)
1028
+ const char *dumpsnapshot, char *use_role, const char *snapfs_snapshot )
1022
1029
{
1023
1030
DumpOptions *dopt = AH->dopt;
1024
1031
PGconn *conn = GetConnection(AH);
@@ -1176,6 +1183,15 @@ setup_connection(Archive *AH, const char *dumpencoding,
1176
1183
1177
1184
AH->sync_snapshot_id = get_synchronized_snapshot(AH);
1178
1185
}
1186
+ if (snapfs_snapshot)
1187
+ AH->snapfs_snapshot_id = pg_strdup(snapfs_snapshot);
1188
+
1189
+ if (AH->snapfs_snapshot_id)
1190
+ {
1191
+ char sql[64];
1192
+ sprintf(sql, "select pg_set_backend_snapshot(%s)", AH->snapfs_snapshot_id);
1193
+ PQclear(ExecuteSqlQueryForSingleRow((Archive *) AH, sql));
1194
+ }
1179
1195
}
1180
1196
1181
1197
/* Set up connection for a parallel worker process */
@@ -1191,6 +1207,7 @@ setupDumpWorker(Archive *AH)
1191
1207
setup_connection(AH,
1192
1208
pg_encoding_to_char(AH->encoding),
1193
1209
NULL,
1210
+ NULL,
1194
1211
NULL);
1195
1212
}
1196
1213
0 commit comments