PostgreSQL Source Code  git master
pg_backup_archiver.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * pg_backup_archiver.h
4  *
5  * Private interface to the pg_dump archiver routines.
6  * It is NOT intended that these routines be called by any
7  * dumper directly.
8  *
9  * See the headers to pg_restore for more details.
10  *
11  * Copyright (c) 2000, Philip Warner
12  * Rights are granted to use this software in any way so long
13  * as this notice is not removed.
14  *
15  * The author is not responsible for loss or damages that may
16  * result from its use.
17  *
18  *
19  * IDENTIFICATION
20  * src/bin/pg_dump/pg_backup_archiver.h
21  *
22  *-------------------------------------------------------------------------
23  */
24 #ifndef __PG_BACKUP_ARCHIVE__
25 #define __PG_BACKUP_ARCHIVE__
26 
27 #include <time.h>
28 
29 #include "libpq-fe.h"
30 #include "pg_backup.h"
31 #include "pqexpbuffer.h"
32 
33 #define LOBBUFSIZE 16384
34 
35 #ifdef HAVE_LIBZ
36 #include <zlib.h>
37 #define GZCLOSE(fh) gzclose(fh)
38 #define GZWRITE(p, s, n, fh) gzwrite(fh, p, (n) * (s))
39 #define GZREAD(p, s, n, fh) gzread(fh, p, (n) * (s))
40 #define GZEOF(fh) gzeof(fh)
41 #else
42 #define GZCLOSE(fh) fclose(fh)
43 #define GZWRITE(p, s, n, fh) (fwrite(p, s, n, fh) * (s))
44 #define GZREAD(p, s, n, fh) fread(p, s, n, fh)
45 #define GZEOF(fh) feof(fh)
46 /* this is just the redefinition of a libz constant */
47 #define Z_DEFAULT_COMPRESSION (-1)
48 
49 typedef struct _z_stream
50 {
51  void *next_in;
52  void *next_out;
53  size_t avail_in;
54  size_t avail_out;
57 #endif
58 
59 /* Data block types */
60 #define BLK_DATA 1
61 #define BLK_BLOBS 3
62 
63 /* Encode version components into a convenient integer <maj><min><rev> */
64 #define MAKE_ARCHIVE_VERSION(major, minor, rev) (((major) * 256 + (minor)) * 256 + (rev))
65 
66 #define ARCHIVE_MAJOR(version) (((version) >> 16) & 255)
67 #define ARCHIVE_MINOR(version) (((version) >> 8) & 255)
68 #define ARCHIVE_REV(version) (((version) ) & 255)
69 
70 /* Historical version numbers (checked in code) */
71 #define K_VERS_1_0 MAKE_ARCHIVE_VERSION(1, 0, 0)
72 #define K_VERS_1_2 MAKE_ARCHIVE_VERSION(1, 2, 0) /* Allow No ZLIB */
73 #define K_VERS_1_3 MAKE_ARCHIVE_VERSION(1, 3, 0) /* BLOBs */
74 #define K_VERS_1_4 MAKE_ARCHIVE_VERSION(1, 4, 0) /* Date & name in header */
75 #define K_VERS_1_5 MAKE_ARCHIVE_VERSION(1, 5, 0) /* Handle dependencies */
76 #define K_VERS_1_6 MAKE_ARCHIVE_VERSION(1, 6, 0) /* Schema field in TOCs */
77 #define K_VERS_1_7 MAKE_ARCHIVE_VERSION(1, 7, 0) /* File Offset size in
78  * header */
79 #define K_VERS_1_8 MAKE_ARCHIVE_VERSION(1, 8, 0) /* change interpretation
80  * of ID numbers and
81  * dependencies */
82 #define K_VERS_1_9 MAKE_ARCHIVE_VERSION(1, 9, 0) /* add default_with_oids
83  * tracking */
84 #define K_VERS_1_10 MAKE_ARCHIVE_VERSION(1, 10, 0) /* add tablespace */
85 #define K_VERS_1_11 MAKE_ARCHIVE_VERSION(1, 11, 0) /* add toc section
86  * indicator */
87 #define K_VERS_1_12 MAKE_ARCHIVE_VERSION(1, 12, 0) /* add separate BLOB
88  * entries */
89 #define K_VERS_1_13 MAKE_ARCHIVE_VERSION(1, 13, 0) /* change search_path
90  * behavior */
91 #define K_VERS_1_14 MAKE_ARCHIVE_VERSION(1, 14, 0) /* add tableam */
92 
93 /* Current archive version number (the format we can output) */
94 #define K_VERS_MAJOR 1
95 #define K_VERS_MINOR 14
96 #define K_VERS_REV 0
97 #define K_VERS_SELF MAKE_ARCHIVE_VERSION(K_VERS_MAJOR, K_VERS_MINOR, K_VERS_REV)
98 
99 /* Newest format we can read */
100 #define K_VERS_MAX MAKE_ARCHIVE_VERSION(K_VERS_MAJOR, K_VERS_MINOR, 255)
101 
102 
103 /* Flags to indicate disposition of offsets stored in files */
104 #define K_OFFSET_POS_NOT_SET 1
105 #define K_OFFSET_POS_SET 2
106 #define K_OFFSET_NO_DATA 3
107 
108 /*
109  * Special exit values from worker children. We reserve 0 for normal
110  * success; 1 and other small values should be interpreted as crashes.
111  */
112 #define WORKER_OK 0
113 #define WORKER_CREATE_DONE 10
114 #define WORKER_INHIBIT_DATA 11
115 #define WORKER_IGNORED_ERRORS 12
116 
117 typedef struct _archiveHandle ArchiveHandle;
118 typedef struct _tocEntry TocEntry;
119 struct ParallelState;
120 
121 #define READ_ERROR_EXIT(fd) \
122  do { \
123  if (feof(fd)) \
124  fatal("could not read from input file: end of file"); \
125  else \
126  fatal("could not read from input file: %m"); \
127  } while (0)
128 
129 #define WRITE_ERROR_EXIT \
130  do { \
131  fatal("could not write to output file: %m"); \
132  } while (0)
133 
134 typedef enum T_Action
135 {
136  ACT_DUMP,
139 
140 typedef void (*ClosePtrType) (ArchiveHandle *AH);
141 typedef void (*ReopenPtrType) (ArchiveHandle *AH);
143 
144 typedef void (*StartDataPtrType) (ArchiveHandle *AH, TocEntry *te);
145 typedef void (*WriteDataPtrType) (ArchiveHandle *AH, const void *data, size_t dLen);
146 typedef void (*EndDataPtrType) (ArchiveHandle *AH, TocEntry *te);
147 
148 typedef void (*StartBlobsPtrType) (ArchiveHandle *AH, TocEntry *te);
149 typedef void (*StartBlobPtrType) (ArchiveHandle *AH, TocEntry *te, Oid oid);
150 typedef void (*EndBlobPtrType) (ArchiveHandle *AH, TocEntry *te, Oid oid);
151 typedef void (*EndBlobsPtrType) (ArchiveHandle *AH, TocEntry *te);
152 
153 typedef int (*WriteBytePtrType) (ArchiveHandle *AH, const int i);
154 typedef int (*ReadBytePtrType) (ArchiveHandle *AH);
155 typedef void (*WriteBufPtrType) (ArchiveHandle *AH, const void *c, size_t len);
156 typedef void (*ReadBufPtrType) (ArchiveHandle *AH, void *buf, size_t len);
158 typedef void (*ReadExtraTocPtrType) (ArchiveHandle *AH, TocEntry *te);
161 
163 typedef void (*ClonePtrType) (ArchiveHandle *AH);
164 typedef void (*DeClonePtrType) (ArchiveHandle *AH);
165 
168 
169 typedef size_t (*CustomOutPtrType) (ArchiveHandle *AH, const void *buf, size_t len);
170 
171 typedef enum
172 {
173  SQL_SCAN = 0, /* normal */
174  SQL_IN_SINGLE_QUOTE, /* '...' literal */
175  SQL_IN_DOUBLE_QUOTE /* "..." identifier */
176 } sqlparseState;
177 
178 typedef struct
179 {
180  sqlparseState state; /* see above */
181  bool backSlash; /* next char is backslash quoted? */
182  PQExpBuffer curCmd; /* incomplete line (NULL if not created) */
183 } sqlparseInfo;
184 
185 typedef enum
186 {
187  STAGE_NONE = 0,
192 
193 typedef enum
194 {
195  OUTPUT_SQLCMDS = 0, /* emitting general SQL commands */
196  OUTPUT_COPYDATA, /* writing COPY data */
197  OUTPUT_OTHERDATA /* writing data as INSERT commands */
199 
200 /*
201  * For historical reasons, ACL items are interspersed with everything else in
202  * a dump file's TOC; typically they're right after the object they're for.
203  * However, we need to restore data before ACLs, as otherwise a read-only
204  * table (ie one where the owner has revoked her own INSERT privilege) causes
205  * data restore failures. On the other hand, matview REFRESH commands should
206  * come out after ACLs, as otherwise non-superuser-owned matviews might not
207  * be able to execute. (If the permissions at the time of dumping would not
208  * allow a REFRESH, too bad; we won't fix that for you.) We also want event
209  * triggers to be restored after ACLs, so that they can't mess those up.
210  *
211  * These considerations force us to make three passes over the TOC,
212  * restoring the appropriate subset of items in each pass. We assume that
213  * the dependency sort resulted in an appropriate ordering of items within
214  * each subset.
215  *
216  * XXX This mechanism should be superseded by tracking dependencies on ACLs
217  * properly; but we'll still need it for old dump files even after that.
218  */
219 typedef enum
220 {
221  RESTORE_PASS_MAIN = 0, /* Main pass (most TOC item types) */
222  RESTORE_PASS_ACL, /* ACL item types */
223  RESTORE_PASS_POST_ACL /* Event trigger and matview refresh items */
224 
225 #define RESTORE_PASS_LAST RESTORE_PASS_POST_ACL
226 } RestorePass;
227 
228 #define REQ_SCHEMA 0x01 /* want schema */
229 #define REQ_DATA 0x02 /* want data */
230 #define REQ_SPECIAL 0x04 /* for special TOC entries */
231 
233 {
234  Archive public; /* Public part of archive */
235  int version; /* Version of file */
236 
237  char *archiveRemoteVersion; /* When reading an archive, the
238  * version of the dumped DB */
239  char *archiveDumpVersion; /* When reading an archive, the version of
240  * the dumper */
241 
242  size_t intSize; /* Size of an integer in the archive */
243  size_t offSize; /* Size of a file offset in the archive -
244  * Added V1.7 */
245  ArchiveFormat format; /* Archive format */
246 
247  sqlparseInfo sqlparse; /* state for parsing INSERT data */
248 
249  time_t createDate; /* Date archive created */
250 
251  /*
252  * Fields used when discovering archive format. For tar format, we load
253  * the first block into the lookahead buffer, and verify that it looks
254  * like a tar header. The tar module must then consume bytes from the
255  * lookahead buffer before reading any more from the file. For custom
256  * format, we load only the "PGDMP" marker into the buffer, and then set
257  * readHeader after confirming it matches. The buffer is vestigial in
258  * this case, as the subsequent code just checks readHeader and doesn't
259  * examine the buffer.
260  */
261  int readHeader; /* Set if we already read "PGDMP" marker */
262  char *lookahead; /* Buffer used when reading header to discover
263  * format */
264  size_t lookaheadSize; /* Allocated size of buffer */
265  size_t lookaheadLen; /* Length of valid data in lookahead */
266  size_t lookaheadPos; /* Current read position in lookahead buffer */
267 
268  ArchiveEntryPtrType ArchiveEntryPtr; /* Called for each metadata object */
269  StartDataPtrType StartDataPtr; /* Called when table data is about to be
270  * dumped */
271  WriteDataPtrType WriteDataPtr; /* Called to send some table data to the
272  * archive */
273  EndDataPtrType EndDataPtr; /* Called when table data dump is finished */
274  WriteBytePtrType WriteBytePtr; /* Write a byte to output */
275  ReadBytePtrType ReadBytePtr; /* Read a byte from an archive */
276  WriteBufPtrType WriteBufPtr; /* Write a buffer of output to the archive */
277  ReadBufPtrType ReadBufPtr; /* Read a buffer of input from the archive */
278  ClosePtrType ClosePtr; /* Close the archive */
279  ReopenPtrType ReopenPtr; /* Reopen the archive */
280  WriteExtraTocPtrType WriteExtraTocPtr; /* Write extra TOC entry data
281  * associated with the current
282  * archive format */
283  ReadExtraTocPtrType ReadExtraTocPtr; /* Read extra info associated with
284  * archive format */
285  PrintExtraTocPtrType PrintExtraTocPtr; /* Extra TOC info for format */
287 
292 
296 
298  ClonePtrType ClonePtr; /* Clone format-specific fields */
299  DeClonePtrType DeClonePtr; /* Clean up cloned fields */
300 
301  CustomOutPtrType CustomOutPtr; /* Alternative script output routine */
302 
303  /* Stuff for direct DB connection */
304  char *archdbname; /* DB name *read* from archive */
305  char *savedPassword; /* password for ropt->username, if known */
306  char *use_role;
308  /* If connCancel isn't NULL, SIGINT handler will send a cancel */
309  PGcancel *volatile connCancel;
310 
311  int connectToDB; /* Flag to indicate if direct DB connection is
312  * required */
313  ArchiverOutput outputKind; /* Flag for what we're currently writing */
314  bool pgCopyIn; /* Currently in libpq 'COPY IN' mode. */
315 
316  int loFd; /* BLOB fd */
317  int writingBlob; /* Flag */
318  int blobCount; /* # of blobs restored */
319 
320  char *fSpec; /* Archive File Spec */
321  FILE *FH; /* General purpose file handle */
322  void *OF;
323  int gzOut; /* Output file */
324 
325  struct _tocEntry *toc; /* Header of circular list of TOC entries */
326  int tocCount; /* Number of TOC entries */
327  DumpId maxDumpId; /* largest DumpId among all TOC entries */
328 
329  /* arrays created after the TOC list is complete: */
330  struct _tocEntry **tocsByDumpId; /* TOCs indexed by dumpId */
331  DumpId *tableDataId; /* TABLE DATA ids, indexed by table dumpId */
332 
333  struct _tocEntry *currToc; /* Used when dumping data */
334  int compression; /*---------
335  * Compression requested on open().
336  * Possible values for compression:
337  * -1 Z_DEFAULT_COMPRESSION
338  * 0 COMPRESSION_NONE
339  * 1-9 levels for gzip compression
340  *---------
341  */
342  bool dosync; /* data requested to be synced on sight */
343  ArchiveMode mode; /* File mode - r or w */
344  void *formatData; /* Header data specific to file format */
345 
346  /* these vars track state to avoid sending redundant SET commands */
347  char *currUser; /* current username, or NULL if unknown */
348  char *currSchema; /* current schema, or NULL */
349  char *currTablespace; /* current tablespace, or NULL */
350  char *currTableAm; /* current table access method, or NULL */
351 
352  void *lo_buf;
353  size_t lo_buf_used;
354  size_t lo_buf_size;
355 
356  int noTocComments;
359  RestorePass restorePass; /* used only during parallel restore */
362 };
363 
364 struct _tocEntry
365 {
366  struct _tocEntry *prev;
367  struct _tocEntry *next;
369  DumpId dumpId;
371  bool hadDumper; /* Archiver was passed a dumper routine (used
372  * in restore) */
373  char *tag; /* index tag */
374  char *namespace; /* null or empty string if not in a schema */
375  char *tablespace; /* null if not in a tablespace; empty string
376  * means use database default */
377  char *tableam; /* table access method, only for TABLE tags */
378  char *owner;
379  char *desc;
380  char *defn;
381  char *dropStmt;
382  char *copyStmt;
383  DumpId *dependencies; /* dumpIds of objects this one depends on */
384  int nDeps; /* number of dependencies */
385 
386  DataDumperPtr dataDumper; /* Routine to dump data for object */
387  const void *dataDumperArg; /* Arg for above routine */
388  void *formatData; /* TOC Entry data specific to file format */
389 
390  /* working state while dumping/restoring */
391  pgoff_t dataLength; /* item's data size; 0 if none or unknown */
392  int reqs; /* do we need schema and/or data of object
393  * (REQ_* bit mask) */
394  bool created; /* set for DATA member if TABLE was created */
395 
396  /* working state (needed only for parallel restore) */
397  struct _tocEntry *pending_prev; /* list links for pending-items list; */
398  struct _tocEntry *pending_next; /* NULL if not in that list */
399  int depCount; /* number of dependencies not yet restored */
400  DumpId *revDeps; /* dumpIds of objects depending on this one */
401  int nRevDeps; /* number of such dependencies */
402  DumpId *lockDeps; /* dumpIds of objects this one needs lock on */
403  int nLockDeps; /* number of such dependencies */
404 };
405 
406 extern int parallel_restore(ArchiveHandle *AH, TocEntry *te);
407 extern void on_exit_close_archive(Archive *AHX);
408 
409 extern void warn_or_exit_horribly(ArchiveHandle *AH, const char *fmt,...) pg_attribute_printf(2, 3);
410 
411 /* Options for ArchiveEntry */
412 typedef struct _archiveOpts
413 {
414  const char *tag;
415  const char *namespace;
416  const char *tablespace;
417  const char *tableam;
418  const char *owner;
419  const char *description;
421  const char *createStmt;
422  const char *dropStmt;
423  const char *copyStmt;
424  const DumpId *deps;
425  int nDeps;
426  DataDumperPtr dumpFn;
427  const void *dumpArg;
428 } ArchiveOpts;
429 #define ARCHIVE_OPTS(...) &(ArchiveOpts){__VA_ARGS__}
430 /* Called to add a TOC entry */
433 
434 extern void WriteHead(ArchiveHandle *AH);
435 extern void ReadHead(ArchiveHandle *AH);
436 extern void WriteToc(ArchiveHandle *AH);
437 extern void ReadToc(ArchiveHandle *AH);
438 extern void WriteDataChunks(ArchiveHandle *AH, struct ParallelState *pstate);
441 extern void DeCloneArchive(ArchiveHandle *AH);
442 
443 extern int TocIDRequired(ArchiveHandle *AH, DumpId id);
445 extern bool checkSeek(FILE *fp);
446 
447 #define appendStringLiteralAHX(buf,str,AH) \
448  appendStringLiteral(buf, str, (AH)->public.encoding, (AH)->public.std_strings)
449 
450 #define appendByteaLiteralAHX(buf,str,len,AH) \
451  appendByteaLiteral(buf, str, len, (AH)->public.std_strings)
452 
453 /*
454  * Mandatory routines for each supported format
455  */
456 
457 extern size_t WriteInt(ArchiveHandle *AH, int i);
458 extern int ReadInt(ArchiveHandle *AH);
459 extern char *ReadStr(ArchiveHandle *AH);
460 extern size_t WriteStr(ArchiveHandle *AH, const char *s);
461 
463 size_t WriteOffset(ArchiveHandle *, pgoff_t, int);
464 
465 extern void StartRestoreBlobs(ArchiveHandle *AH);
466 extern void StartRestoreBlob(ArchiveHandle *AH, Oid oid, bool drop);
467 extern void EndRestoreBlob(ArchiveHandle *AH, Oid oid);
468 extern void EndRestoreBlobs(ArchiveHandle *AH);
469 
470 extern void InitArchiveFmt_Custom(ArchiveHandle *AH);
471 extern void InitArchiveFmt_Null(ArchiveHandle *AH);
472 extern void InitArchiveFmt_Directory(ArchiveHandle *AH);
473 extern void InitArchiveFmt_Tar(ArchiveHandle *AH);
474 
475 extern bool isValidTarHeader(char *header);
476 
477 extern void ReconnectToServer(ArchiveHandle *AH, const char *dbname);
478 extern void DropBlobIfExists(ArchiveHandle *AH, Oid oid);
479 
480 void ahwrite(const void *ptr, size_t size, size_t nmemb, ArchiveHandle *AH);
481 int ahprintf(ArchiveHandle *AH, const char *fmt,...) pg_attribute_printf(2, 3);
482 
483 #endif
#define pg_attribute_printf(f, a)
Definition: c.h:164
int i
Definition: isn.c:73
static void const char * fmt
static AmcheckOptions opts
Definition: pg_amcheck.c:110
int DumpId
Definition: pg_backup.h:244
void(* SetupWorkerPtrType)(Archive *AH)
Definition: pg_backup.h:254
enum _archiveFormat ArchiveFormat
enum _teSection teSection
int(* DataDumperPtr)(Archive *AH, const void *userArg)
Definition: pg_backup.h:252
z_stream * z_streamp
void DeCloneArchive(ArchiveHandle *AH)
int TocIDRequired(ArchiveHandle *AH, DumpId id)
bool checkSeek(FILE *fp)
void ahwrite(const void *ptr, size_t size, size_t nmemb, ArchiveHandle *AH)
void InitArchiveFmt_Null(ArchiveHandle *AH)
void WriteDataChunksForTocEntry(ArchiveHandle *AH, TocEntry *te)
void WriteHead(ArchiveHandle *AH)
void(* EndBlobsPtrType)(ArchiveHandle *AH, TocEntry *te)
void(* ReadExtraTocPtrType)(ArchiveHandle *AH, TocEntry *te)
void DropBlobIfExists(ArchiveHandle *AH, Oid oid)
Definition: pg_backup_db.c:549
TocEntry * getTocEntryByDumpId(ArchiveHandle *AH, DumpId id)
size_t WriteInt(ArchiveHandle *AH, int i)
void struct _archiveOpts ArchiveOpts
void(* PrintTocDataPtrType)(ArchiveHandle *AH, TocEntry *te)
int(* WorkerJobDumpPtrType)(ArchiveHandle *AH, TocEntry *te)
void(* EndDataPtrType)(ArchiveHandle *AH, TocEntry *te)
void(* StartDataPtrType)(ArchiveHandle *AH, TocEntry *te)
ArchiveHandle * CloneArchive(ArchiveHandle *AH)
int(* WorkerJobRestorePtrType)(ArchiveHandle *AH, TocEntry *te)
void InitArchiveFmt_Custom(ArchiveHandle *AH)
sqlparseState
@ SQL_IN_DOUBLE_QUOTE
@ SQL_IN_SINGLE_QUOTE
@ SQL_SCAN
void InitArchiveFmt_Tar(ArchiveHandle *AH)
size_t WriteOffset(ArchiveHandle *, pgoff_t, int)
void StartRestoreBlob(ArchiveHandle *AH, Oid oid, bool drop)
void(* DeClonePtrType)(ArchiveHandle *AH)
void ReconnectToServer(ArchiveHandle *AH, const char *dbname)
Definition: pg_backup_db.c:78
int(* WriteBytePtrType)(ArchiveHandle *AH, const int i)
void(* WriteBufPtrType)(ArchiveHandle *AH, const void *c, size_t len)
void(* ClonePtrType)(ArchiveHandle *AH)
int ReadOffset(ArchiveHandle *, pgoff_t *)
void warn_or_exit_horribly(ArchiveHandle *AH, const char *fmt,...) pg_attribute_printf(2
void(* ClosePtrType)(ArchiveHandle *AH)
bool isValidTarHeader(char *header)
void(* PrintExtraTocPtrType)(ArchiveHandle *AH, TocEntry *te)
void(* WriteDataPtrType)(ArchiveHandle *AH, const void *data, size_t dLen)
ArchiverStage
@ STAGE_INITIALIZING
@ STAGE_PROCESSING
@ STAGE_NONE
@ STAGE_FINALIZING
@ ACT_RESTORE
@ ACT_DUMP
char * ReadStr(ArchiveHandle *AH)
int ReadInt(ArchiveHandle *AH)
void(* StartBlobPtrType)(ArchiveHandle *AH, TocEntry *te, Oid oid)
void(* ArchiveEntryPtrType)(ArchiveHandle *AH, TocEntry *te)
void(* WriteExtraTocPtrType)(ArchiveHandle *AH, TocEntry *te)
void on_exit_close_archive(Archive *AHX)
Definition: parallel.c:333
TocEntry * ArchiveEntry(Archive *AHX, CatalogId catalogId, DumpId dumpId, ArchiveOpts *opts)
void(* StartBlobsPtrType)(ArchiveHandle *AH, TocEntry *te)
void WriteDataChunks(ArchiveHandle *AH, struct ParallelState *pstate)
void StartRestoreBlobs(ArchiveHandle *AH)
void ReadHead(ArchiveHandle *AH)
void ReadToc(ArchiveHandle *AH)
void(* EndBlobPtrType)(ArchiveHandle *AH, TocEntry *te, Oid oid)
ArchiverOutput
@ OUTPUT_COPYDATA
@ OUTPUT_SQLCMDS
@ OUTPUT_OTHERDATA
int ahprintf(ArchiveHandle *AH, const char *fmt,...) pg_attribute_printf(2
int(* ReadBytePtrType)(ArchiveHandle *AH)
size_t(* CustomOutPtrType)(ArchiveHandle *AH, const void *buf, size_t len)
void WriteToc(ArchiveHandle *AH)
void InitArchiveFmt_Directory(ArchiveHandle *AH)
void(* ReadBufPtrType)(ArchiveHandle *AH, void *buf, size_t len)
void EndRestoreBlob(ArchiveHandle *AH, Oid oid)
void(* ReopenPtrType)(ArchiveHandle *AH)
void EndRestoreBlobs(ArchiveHandle *AH)
@ RESTORE_PASS_ACL
@ RESTORE_PASS_MAIN
struct _z_stream z_stream
int parallel_restore(ArchiveHandle *AH, TocEntry *te)
void(* PrepParallelRestorePtrType)(ArchiveHandle *AH)
size_t WriteStr(ArchiveHandle *AH, const char *s)
const void size_t len
const void * data
static void header(const char *fmt,...) pg_attribute_printf(1
Definition: pg_regress.c:212
static char * buf
Definition: pg_test_fsync.c:70
char * tablespace
Definition: pgbench.c:227
unsigned int Oid
Definition: postgres_ext.h:31
char * c
char * dbname
Definition: streamutil.c:51
TocEntry ** te
Definition: parallel.h:59
ArchiverStage stage
RestorePass restorePass
ArchiveFormat format
struct _tocEntry * toc
DeClonePtrType DeClonePtr
struct _tocEntry * lastErrorTE
ReadExtraTocPtrType ReadExtraTocPtr
struct _tocEntry * currentTE
CustomOutPtrType CustomOutPtr
WorkerJobDumpPtrType WorkerJobDumpPtr
PGcancel *volatile connCancel
EndBlobPtrType EndBlobPtr
ArchiveEntryPtrType ArchiveEntryPtr
WriteDataPtrType WriteDataPtr
struct _tocEntry ** tocsByDumpId
ClonePtrType ClonePtr
StartBlobsPtrType StartBlobsPtr
WriteBufPtrType WriteBufPtr
PrepParallelRestorePtrType PrepParallelRestorePtr
StartBlobPtrType StartBlobPtr
WriteExtraTocPtrType WriteExtraTocPtr
ReadBytePtrType ReadBytePtr
WorkerJobRestorePtrType WorkerJobRestorePtr
PrintTocDataPtrType PrintTocDataPtr
struct _tocEntry * currToc
WriteBytePtrType WriteBytePtr
sqlparseInfo sqlparse
ReadBufPtrType ReadBufPtr
PrintExtraTocPtrType PrintExtraTocPtr
EndBlobsPtrType EndBlobsPtr
ArchiverStage lastErrorStage
StartDataPtrType StartDataPtr
ReopenPtrType ReopenPtr
ArchiverOutput outputKind
EndDataPtrType EndDataPtr
SetupWorkerPtrType SetupWorkerPtr
ClosePtrType ClosePtr
struct _tocEntry * pending_next
struct _tocEntry * prev
teSection section
struct _tocEntry * pending_prev
DataDumperPtr dataDumper
pgoff_t dataLength
CatalogId catalogId
struct _tocEntry * next
const void * dataDumperArg
DumpId * revDeps
DumpId * dependencies
DumpId * lockDeps
Definition: regguts.h:318
#define pgoff_t
Definition: win32_port.h:208
ArchiveMode
Definition: xlog.h:111