mirror of
https://github.com/postgres/postgres.git
synced 2025-05-30 00:02:11 -04:00
pg_dump: Remove global Archive pointer.
Instead, everything that needs the Archive object now gets it as a parameter. This is necessary infrastructure for parallel pg_dump, but is also amply justified by the ugliness of the current code (though a lot more than this is needed to fix that problem).
This commit is contained in:
parent
622f862868
commit
3b157cf21d
@ -76,7 +76,7 @@ static int strInArray(const char *pattern, char **arr, int arr_size);
|
||||
* Collect information about all potentially dumpable objects
|
||||
*/
|
||||
TableInfo *
|
||||
getSchemaData(int *numTablesPtr)
|
||||
getSchemaData(Archive *fout, int *numTablesPtr)
|
||||
{
|
||||
ExtensionInfo *extinfo;
|
||||
InhInfo *inhinfo;
|
||||
@ -101,7 +101,7 @@ getSchemaData(int *numTablesPtr)
|
||||
|
||||
if (g_verbose)
|
||||
write_msg(NULL, "reading schemas\n");
|
||||
getNamespaces(&numNamespaces);
|
||||
getNamespaces(fout, &numNamespaces);
|
||||
|
||||
/*
|
||||
* getTables should be done as soon as possible, so as to minimize the
|
||||
@ -111,94 +111,94 @@ getSchemaData(int *numTablesPtr)
|
||||
*/
|
||||
if (g_verbose)
|
||||
write_msg(NULL, "reading user-defined tables\n");
|
||||
tblinfo = getTables(&numTables);
|
||||
tblinfo = getTables(fout, &numTables);
|
||||
tblinfoindex = buildIndexArray(tblinfo, numTables, sizeof(TableInfo));
|
||||
|
||||
if (g_verbose)
|
||||
write_msg(NULL, "reading extensions\n");
|
||||
extinfo = getExtensions(&numExtensions);
|
||||
extinfo = getExtensions(fout, &numExtensions);
|
||||
|
||||
if (g_verbose)
|
||||
write_msg(NULL, "reading user-defined functions\n");
|
||||
funinfo = getFuncs(&numFuncs);
|
||||
funinfo = getFuncs(fout, &numFuncs);
|
||||
funinfoindex = buildIndexArray(funinfo, numFuncs, sizeof(FuncInfo));
|
||||
|
||||
/* this must be after getTables and getFuncs */
|
||||
if (g_verbose)
|
||||
write_msg(NULL, "reading user-defined types\n");
|
||||
typinfo = getTypes(&numTypes);
|
||||
typinfo = getTypes(fout, &numTypes);
|
||||
typinfoindex = buildIndexArray(typinfo, numTypes, sizeof(TypeInfo));
|
||||
|
||||
/* this must be after getFuncs, too */
|
||||
if (g_verbose)
|
||||
write_msg(NULL, "reading procedural languages\n");
|
||||
getProcLangs(&numProcLangs);
|
||||
getProcLangs(fout, &numProcLangs);
|
||||
|
||||
if (g_verbose)
|
||||
write_msg(NULL, "reading user-defined aggregate functions\n");
|
||||
getAggregates(&numAggregates);
|
||||
getAggregates(fout, &numAggregates);
|
||||
|
||||
if (g_verbose)
|
||||
write_msg(NULL, "reading user-defined operators\n");
|
||||
oprinfo = getOperators(&numOperators);
|
||||
oprinfo = getOperators(fout, &numOperators);
|
||||
oprinfoindex = buildIndexArray(oprinfo, numOperators, sizeof(OprInfo));
|
||||
|
||||
if (g_verbose)
|
||||
write_msg(NULL, "reading user-defined operator classes\n");
|
||||
getOpclasses(&numOpclasses);
|
||||
getOpclasses(fout, &numOpclasses);
|
||||
|
||||
if (g_verbose)
|
||||
write_msg(NULL, "reading user-defined operator families\n");
|
||||
getOpfamilies(&numOpfamilies);
|
||||
getOpfamilies(fout, &numOpfamilies);
|
||||
|
||||
if (g_verbose)
|
||||
write_msg(NULL, "reading user-defined text search parsers\n");
|
||||
getTSParsers(&numTSParsers);
|
||||
getTSParsers(fout, &numTSParsers);
|
||||
|
||||
if (g_verbose)
|
||||
write_msg(NULL, "reading user-defined text search templates\n");
|
||||
getTSTemplates(&numTSTemplates);
|
||||
getTSTemplates(fout, &numTSTemplates);
|
||||
|
||||
if (g_verbose)
|
||||
write_msg(NULL, "reading user-defined text search dictionaries\n");
|
||||
getTSDictionaries(&numTSDicts);
|
||||
getTSDictionaries(fout, &numTSDicts);
|
||||
|
||||
if (g_verbose)
|
||||
write_msg(NULL, "reading user-defined text search configurations\n");
|
||||
getTSConfigurations(&numTSConfigs);
|
||||
getTSConfigurations(fout, &numTSConfigs);
|
||||
|
||||
if (g_verbose)
|
||||
write_msg(NULL, "reading user-defined foreign-data wrappers\n");
|
||||
getForeignDataWrappers(&numForeignDataWrappers);
|
||||
getForeignDataWrappers(fout, &numForeignDataWrappers);
|
||||
|
||||
if (g_verbose)
|
||||
write_msg(NULL, "reading user-defined foreign servers\n");
|
||||
getForeignServers(&numForeignServers);
|
||||
getForeignServers(fout, &numForeignServers);
|
||||
|
||||
if (g_verbose)
|
||||
write_msg(NULL, "reading default privileges\n");
|
||||
getDefaultACLs(&numDefaultACLs);
|
||||
getDefaultACLs(fout, &numDefaultACLs);
|
||||
|
||||
if (g_verbose)
|
||||
write_msg(NULL, "reading user-defined collations\n");
|
||||
collinfo = getCollations(&numCollations);
|
||||
collinfo = getCollations(fout, &numCollations);
|
||||
collinfoindex = buildIndexArray(collinfo, numCollations, sizeof(CollInfo));
|
||||
|
||||
if (g_verbose)
|
||||
write_msg(NULL, "reading user-defined conversions\n");
|
||||
getConversions(&numConversions);
|
||||
getConversions(fout, &numConversions);
|
||||
|
||||
if (g_verbose)
|
||||
write_msg(NULL, "reading type casts\n");
|
||||
getCasts(&numCasts);
|
||||
getCasts(fout, &numCasts);
|
||||
|
||||
if (g_verbose)
|
||||
write_msg(NULL, "reading table inheritance information\n");
|
||||
inhinfo = getInherits(&numInherits);
|
||||
inhinfo = getInherits(fout, &numInherits);
|
||||
|
||||
if (g_verbose)
|
||||
write_msg(NULL, "reading rewrite rules\n");
|
||||
getRules(&numRules);
|
||||
getRules(fout, &numRules);
|
||||
|
||||
/*
|
||||
* Identify extension member objects and mark them as not to be dumped.
|
||||
@ -207,7 +207,7 @@ getSchemaData(int *numTablesPtr)
|
||||
*/
|
||||
if (g_verbose)
|
||||
write_msg(NULL, "finding extension members\n");
|
||||
getExtensionMembership(extinfo, numExtensions);
|
||||
getExtensionMembership(fout, extinfo, numExtensions);
|
||||
|
||||
/* Link tables to parents, mark parents of target tables interesting */
|
||||
if (g_verbose)
|
||||
@ -216,7 +216,7 @@ getSchemaData(int *numTablesPtr)
|
||||
|
||||
if (g_verbose)
|
||||
write_msg(NULL, "reading column info for interesting tables\n");
|
||||
getTableAttrs(tblinfo, numTables);
|
||||
getTableAttrs(fout, tblinfo, numTables);
|
||||
|
||||
if (g_verbose)
|
||||
write_msg(NULL, "flagging inherited columns in subtables\n");
|
||||
@ -224,15 +224,15 @@ getSchemaData(int *numTablesPtr)
|
||||
|
||||
if (g_verbose)
|
||||
write_msg(NULL, "reading indexes\n");
|
||||
getIndexes(tblinfo, numTables);
|
||||
getIndexes(fout, tblinfo, numTables);
|
||||
|
||||
if (g_verbose)
|
||||
write_msg(NULL, "reading constraints\n");
|
||||
getConstraints(tblinfo, numTables);
|
||||
getConstraints(fout, tblinfo, numTables);
|
||||
|
||||
if (g_verbose)
|
||||
write_msg(NULL, "reading triggers\n");
|
||||
getTriggers(tblinfo, numTables);
|
||||
getTriggers(fout, tblinfo, numTables);
|
||||
|
||||
*numTablesPtr = numTables;
|
||||
return tblinfo;
|
||||
|
@ -81,7 +81,7 @@ typedef enum
|
||||
* We may want to have some more user-readable data, but in the mean
|
||||
* time this gives us some abstraction and type checking.
|
||||
*/
|
||||
typedef struct _Archive
|
||||
struct Archive
|
||||
{
|
||||
int verbose;
|
||||
char *remoteVersionStr; /* server's version string */
|
||||
@ -99,7 +99,7 @@ typedef struct _Archive
|
||||
int n_errors; /* number of errors (if no die) */
|
||||
|
||||
/* The rest is private */
|
||||
} Archive;
|
||||
};
|
||||
|
||||
typedef int (*DataDumperPtr) (Archive *AH, void *userArg);
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -493,7 +493,10 @@ extern char g_opaque_type[10]; /* name for the opaque type */
|
||||
* common utility functions
|
||||
*/
|
||||
|
||||
extern TableInfo *getSchemaData(int *numTablesPtr);
|
||||
struct Archive;
|
||||
typedef struct Archive Archive;
|
||||
|
||||
extern TableInfo *getSchemaData(Archive *, int *numTablesPtr);
|
||||
|
||||
typedef enum _OidOptions
|
||||
{
|
||||
@ -535,32 +538,35 @@ extern void sortDumpableObjectsByTypeOid(DumpableObject **objs, int numObjs);
|
||||
/*
|
||||
* version specific routines
|
||||
*/
|
||||
extern NamespaceInfo *getNamespaces(int *numNamespaces);
|
||||
extern ExtensionInfo *getExtensions(int *numExtensions);
|
||||
extern TypeInfo *getTypes(int *numTypes);
|
||||
extern FuncInfo *getFuncs(int *numFuncs);
|
||||
extern AggInfo *getAggregates(int *numAggregates);
|
||||
extern OprInfo *getOperators(int *numOperators);
|
||||
extern OpclassInfo *getOpclasses(int *numOpclasses);
|
||||
extern OpfamilyInfo *getOpfamilies(int *numOpfamilies);
|
||||
extern CollInfo *getCollations(int *numCollations);
|
||||
extern ConvInfo *getConversions(int *numConversions);
|
||||
extern TableInfo *getTables(int *numTables);
|
||||
extern InhInfo *getInherits(int *numInherits);
|
||||
extern void getIndexes(TableInfo tblinfo[], int numTables);
|
||||
extern void getConstraints(TableInfo tblinfo[], int numTables);
|
||||
extern RuleInfo *getRules(int *numRules);
|
||||
extern void getTriggers(TableInfo tblinfo[], int numTables);
|
||||
extern ProcLangInfo *getProcLangs(int *numProcLangs);
|
||||
extern CastInfo *getCasts(int *numCasts);
|
||||
extern void getTableAttrs(TableInfo *tbinfo, int numTables);
|
||||
extern TSParserInfo *getTSParsers(int *numTSParsers);
|
||||
extern TSDictInfo *getTSDictionaries(int *numTSDicts);
|
||||
extern TSTemplateInfo *getTSTemplates(int *numTSTemplates);
|
||||
extern TSConfigInfo *getTSConfigurations(int *numTSConfigs);
|
||||
extern FdwInfo *getForeignDataWrappers(int *numForeignDataWrappers);
|
||||
extern ForeignServerInfo *getForeignServers(int *numForeignServers);
|
||||
extern DefaultACLInfo *getDefaultACLs(int *numDefaultACLs);
|
||||
extern void getExtensionMembership(ExtensionInfo extinfo[], int numExtensions);
|
||||
extern NamespaceInfo *getNamespaces(Archive *fout, int *numNamespaces);
|
||||
extern ExtensionInfo *getExtensions(Archive *fout, int *numExtensions);
|
||||
extern TypeInfo *getTypes(Archive *fout, int *numTypes);
|
||||
extern FuncInfo *getFuncs(Archive *fout, int *numFuncs);
|
||||
extern AggInfo *getAggregates(Archive *fout, int *numAggregates);
|
||||
extern OprInfo *getOperators(Archive *fout, int *numOperators);
|
||||
extern OpclassInfo *getOpclasses(Archive *fout, int *numOpclasses);
|
||||
extern OpfamilyInfo *getOpfamilies(Archive *fout, int *numOpfamilies);
|
||||
extern CollInfo *getCollations(Archive *fout, int *numCollations);
|
||||
extern ConvInfo *getConversions(Archive *fout, int *numConversions);
|
||||
extern TableInfo *getTables(Archive *fout, int *numTables);
|
||||
extern InhInfo *getInherits(Archive *fout, int *numInherits);
|
||||
extern void getIndexes(Archive *fout, TableInfo tblinfo[], int numTables);
|
||||
extern void getConstraints(Archive *fout, TableInfo tblinfo[], int numTables);
|
||||
extern RuleInfo *getRules(Archive *fout, int *numRules);
|
||||
extern void getTriggers(Archive *fout, TableInfo tblinfo[], int numTables);
|
||||
extern ProcLangInfo *getProcLangs(Archive *fout, int *numProcLangs);
|
||||
extern CastInfo *getCasts(Archive *fout, int *numCasts);
|
||||
extern void getTableAttrs(Archive *fout, TableInfo *tbinfo, int numTables);
|
||||
extern TSParserInfo *getTSParsers(Archive *fout, int *numTSParsers);
|
||||
extern TSDictInfo *getTSDictionaries(Archive *fout, int *numTSDicts);
|
||||
extern TSTemplateInfo *getTSTemplates(Archive *fout, int *numTSTemplates);
|
||||
extern TSConfigInfo *getTSConfigurations(Archive *fout, int *numTSConfigs);
|
||||
extern FdwInfo *getForeignDataWrappers(Archive *fout,
|
||||
int *numForeignDataWrappers);
|
||||
extern ForeignServerInfo *getForeignServers(Archive *fout,
|
||||
int *numForeignServers);
|
||||
extern DefaultACLInfo *getDefaultACLs(Archive *fout, int *numDefaultACLs);
|
||||
extern void getExtensionMembership(Archive *fout, ExtensionInfo extinfo[],
|
||||
int numExtensions);
|
||||
|
||||
#endif /* PG_DUMP_H */
|
||||
|
Loading…
x
Reference in New Issue
Block a user