diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2014-10-14 15:00:55 -0300 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2014-10-14 15:00:55 -0300 |
commit | 0eea8047bf0e15b402b951e383e39236bdfe57d5 (patch) | |
tree | 450b0761bb6d674de42e9018ac38c1d5f40e11f3 /src/bin/pg_dump/parallel.h | |
parent | e0d97d77bf0875e4d5cc7dedfe701d9999bf678c (diff) | |
download | postgresql-0eea8047bf0e15b402b951e383e39236bdfe57d5.tar.gz postgresql-0eea8047bf0e15b402b951e383e39236bdfe57d5.zip |
pg_dump: Reduce use of global variables
Most pg_dump.c global variables, which were passed down individually to
dumping routines, are now grouped as members of the new DumpOptions
struct, which is used as a local variable and passed down into routines
that need it. This helps future development efforts; in particular it
is said to enable a mode in which a parallel pg_dump run can output
multiple streams, and have them restored in parallel.
Also take the opportunity to clean up the pg_dump header files somewhat,
to avoid circularity.
Author: Joachim Wieland, revised by Álvaro Herrera
Reviewed by Peter Eisentraut
Diffstat (limited to 'src/bin/pg_dump/parallel.h')
-rw-r--r-- | src/bin/pg_dump/parallel.h | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/src/bin/pg_dump/parallel.h b/src/bin/pg_dump/parallel.h index 7a32a9bc691..dd3546f2788 100644 --- a/src/bin/pg_dump/parallel.h +++ b/src/bin/pg_dump/parallel.h @@ -19,10 +19,7 @@ #ifndef PG_DUMP_PARALLEL_H #define PG_DUMP_PARALLEL_H -#include "pg_backup_db.h" - -struct _archiveHandle; -struct _tocEntry; +#include "pg_backup_archiver.h" typedef enum { @@ -35,8 +32,8 @@ typedef enum /* Arguments needed for a worker process */ typedef struct ParallelArgs { - struct _archiveHandle *AH; - struct _tocEntry *te; + ArchiveHandle *AH; + TocEntry *te; } ParallelArgs; /* State for each parallel activity slot */ @@ -74,22 +71,19 @@ extern void init_parallel_dump_utils(void); extern int GetIdleWorker(ParallelState *pstate); extern bool IsEveryWorkerIdle(ParallelState *pstate); -extern void ListenToWorkers(struct _archiveHandle * AH, ParallelState *pstate, bool do_wait); +extern void ListenToWorkers(ArchiveHandle *AH, ParallelState *pstate, bool do_wait); extern int ReapWorkerStatus(ParallelState *pstate, int *status); -extern void EnsureIdleWorker(struct _archiveHandle * AH, ParallelState *pstate); -extern void EnsureWorkersFinished(struct _archiveHandle * AH, ParallelState *pstate); +extern void EnsureIdleWorker(ArchiveHandle *AH, ParallelState *pstate); +extern void EnsureWorkersFinished(ArchiveHandle *AH, ParallelState *pstate); -extern ParallelState *ParallelBackupStart(struct _archiveHandle * AH, +extern ParallelState *ParallelBackupStart(ArchiveHandle *AH, + DumpOptions *dopt, RestoreOptions *ropt); -extern void DispatchJobForTocEntry(struct _archiveHandle * AH, +extern void DispatchJobForTocEntry(ArchiveHandle *AH, ParallelState *pstate, - struct _tocEntry * te, T_Action act); -extern void ParallelBackupEnd(struct _archiveHandle * AH, ParallelState *pstate); - -extern void checkAborting(struct _archiveHandle * AH); + TocEntry *te, T_Action act); +extern void ParallelBackupEnd(ArchiveHandle *AH, ParallelState *pstate); -extern void -exit_horribly(const char *modulename, const char *fmt,...) -__attribute__((format(PG_PRINTF_ATTRIBUTE, 2, 3), noreturn)); +extern void checkAborting(ArchiveHandle *AH); #endif /* PG_DUMP_PARALLEL_H */ |