/* For now, pg_upgrade does not use common/logging.c; use our own pg_fatal */ #undef pg_fatal
/* Use port in the private/dynamic port number range */ #define DEF_PGUPORT 50432
#define MAX_STRING 1024 #define QUERY_ALLOC 8192
#define MESSAGE_WIDTH 62
#define GET_MAJOR_VERSION(v) ((v) / 100)
/* contains both global db information and CREATE DATABASE commands */ #define GLOBALS_DUMP_FILE "pg_upgrade_dump_globals.sql" #define DB_DUMP_FILE_MASK "pg_upgrade_dump_%u.custom"
/* *Eachrelationisrepresentedbyarelinfostructure.
*/ typedefstruct
{ /* Can't use NAMEDATALEN; not guaranteed to be same on client */ char *nspname; /* namespace name */ char *relname; /* relation name */
Oid reloid; /* relation OID */
RelFileNumber relfilenumber; /* relation file number */
Oid indtable; /* if index, OID of its table, else 0 */
Oid toastheap; /* if toast table, OID of base table, else 0 */ char *tablespace; /* tablespace path; "" for cluster default */ bool nsp_alloc; /* should nspname be freed? */ bool tblsp_alloc; /* should tablespace be freed? */
} RelInfo;
typedefstruct
{
RelInfo *rels; int nrels;
} RelInfoArr;
/* *Structuretostorelogicalreplicationslotinformation.
*/ typedefstruct
{ char *slotname; /* slot name */ char *plugin; /* plugin */ bool two_phase; /* can the slot decode 2PC? */ bool caught_up; /* has the slot caught up to latest changes? */ bool invalid; /* if true, the slot is unusable */ bool failover; /* is the slot designated to be synced to the
* physical standby? */
} LogicalSlotInfo;
typedefstruct
{ int nslots; /* number of logical slot infos */
LogicalSlotInfo *slots; /* array of logical slot infos */
} LogicalSlotInfoArr;
/* *Thefollowingstructurerepresentsarelationmapping.
*/ typedefstruct
{ constchar *old_tablespace; constchar *new_tablespace; constchar *old_tablespace_suffix; constchar *new_tablespace_suffix;
Oid db_oid;
RelFileNumber relfilenumber; /* the rest are used only for logging and error reporting */ char *nspname; /* namespaces */ char *relname;
} FileNameMap;
/* *Structuretostoredatabaseinformation
*/ typedefstruct
{
Oid db_oid; /* oid of the database */ char *db_name; /* database name */ char db_tablespace[MAXPGPATH]; /* database default tablespace
* path */
RelInfoArr rel_arr; /* array of all user relinfos */
LogicalSlotInfoArr slot_arr; /* array of all LogicalSlotInfo */
} DbInfo;
/* *Enumerationtodenotepg_logmodes
*/ typedefenum
{
PG_VERBOSE,
PG_STATUS, /* these messages do not get a newline added */
PG_REPORT_NONL, /* these too */
PG_REPORT,
PG_WARNING,
PG_FATAL,
} eLogType;
/* *cluster * *informationabouteachcluster
*/ typedefstruct
{
ControlData controldata; /* pg_control information */
DbLocaleInfo *template0; /* template0 locale info */
DbInfoArr dbarr; /* dbinfos array */ char *pgdata; /* pathname for cluster's $PGDATA directory */ char *pgconfig; /* pathname for cluster's config file
* directory */ char *bindir; /* pathname for cluster's executable directory */ char *pgopts; /* options to pass to the server, like pg_ctl
* -o */ char *sockdir; /* directory for Unix Domain socket, if any */ unsignedshort port; /* port number where postmaster is waiting */
uint32 major_version; /* PG_VERSION of cluster */ char major_version_str[64]; /* string PG_VERSION of cluster */
uint32 bin_version; /* version returned from pg_ctl */ constchar *tablespace_suffix; /* directory specification */ int nsubs; /* number of subscriptions */
} ClusterInfo;
/* *LogOpts
*/ typedefstruct
{
FILE *internal; /* internal log FILE */ bool verbose; /* true -> be verbose in messages */ bool retain; /* retain log files on success */ /* Set of internal directories for output files */ char *rootdir; /* Root directory, aka pg_upgrade_output.d */ char *basedir; /* Base output directory, with timestamp */ char *dumpdir; /* Dumps */ char *logdir; /* Log files */ bool isatty; /* is stdout a tty */
} LogOpts;
/* *UserOpts
*/ typedefstruct
{ bool check; /* check clusters only, don't change any data */ bool live_check; /* check clusters only, old server is running */ bool do_sync; /* flush changes to disk */
transferMode transfer_mode; /* copy files or link them? */ int jobs; /* number of processes/threads to use */ char *socketdir; /* directory to use for Unix sockets */ char *sync_method; bool do_statistics; /* carry over statistics from old cluster */ int char_signedness; /* default char signedness: -1 for initial *value,1for"signed"and0for
* "unsigned" */
} UserOpts;
typedefstruct
{ char *name; int dbnum;
} LibraryInfo;
/* *OSInfo
*/ typedefstruct
{ constchar *progname; /* complete pathname for this program */ char *user; /* username for clusters */ bool user_specified; /* user specified on command-line */ char **old_tablespaces; /* tablespaces */ int num_old_tablespaces;
LibraryInfo *libraries; /* loadable libraries */ int num_libraries;
ClusterInfo *running_cluster;
} OSInfo;
/* Function signature for data type check version hook */ typedefbool (*DataTypesUsageVersionCheck) (ClusterInfo *cluster);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.