mirror of
https://github.com/postgres/postgres.git
synced 2025-11-25 12:03:53 +03:00
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
This commit is contained in:
@@ -27,12 +27,11 @@
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#include "postgres_fe.h"
|
||||
|
||||
#include "pg_backup.h"
|
||||
#include "pg_backup_archiver.h"
|
||||
#include "pg_backup_tar.h"
|
||||
#include "pg_backup_utils.h"
|
||||
#include "parallel.h"
|
||||
#include "pgtar.h"
|
||||
|
||||
#include <sys/stat.h>
|
||||
@@ -48,7 +47,7 @@ static int _WriteByte(ArchiveHandle *AH, const int i);
|
||||
static int _ReadByte(ArchiveHandle *);
|
||||
static void _WriteBuf(ArchiveHandle *AH, const void *buf, size_t len);
|
||||
static void _ReadBuf(ArchiveHandle *AH, void *buf, size_t len);
|
||||
static void _CloseArchive(ArchiveHandle *AH);
|
||||
static void _CloseArchive(ArchiveHandle *AH, DumpOptions *dopt);
|
||||
static void _PrintTocData(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt);
|
||||
static void _WriteExtraToc(ArchiveHandle *AH, TocEntry *te);
|
||||
static void _ReadExtraToc(ArchiveHandle *AH, TocEntry *te);
|
||||
@@ -827,7 +826,7 @@ _ReadBuf(ArchiveHandle *AH, void *buf, size_t len)
|
||||
}
|
||||
|
||||
static void
|
||||
_CloseArchive(ArchiveHandle *AH)
|
||||
_CloseArchive(ArchiveHandle *AH, DumpOptions *dopt)
|
||||
{
|
||||
lclContext *ctx = (lclContext *) AH->formatData;
|
||||
TAR_MEMBER *th;
|
||||
@@ -850,7 +849,7 @@ _CloseArchive(ArchiveHandle *AH)
|
||||
/*
|
||||
* Now send the data (tables & blobs)
|
||||
*/
|
||||
WriteDataChunks(AH, NULL);
|
||||
WriteDataChunks(AH, dopt, NULL);
|
||||
|
||||
/*
|
||||
* Now this format wants to append a script which does a full restore
|
||||
|
||||
Reference in New Issue
Block a user