PostgreSQL Source Code
git master
|
#include <unistd.h>
#include <assert.h>
#include <sys/stat.h>
#include <sys/time.h>
#include "libpq-fe.h"
Go to the source code of this file.
Data Structures | |
struct | RelInfo |
struct | RelInfoArr |
struct | FileNameMap |
struct | DbInfo |
struct | DbInfoArr |
struct | ControlData |
struct | ClusterInfo |
struct | LogOpts |
struct | UserOpts |
struct | LibraryInfo |
struct | OSInfo |
Macros | |
#define | DEF_PGUPORT 50432 |
#define | MAX_STRING 1024 |
#define | QUERY_ALLOC 8192 |
#define | MESSAGE_WIDTH 60 |
#define | GET_MAJOR_VERSION(v) ((v) / 100) |
#define | GLOBALS_DUMP_FILE "pg_upgrade_dump_globals.sql" |
#define | DB_DUMP_FILE_MASK "pg_upgrade_dump_%u.custom" |
#define | DB_DUMP_LOG_FILE_MASK "pg_upgrade_dump_%u.log" |
#define | SERVER_LOG_FILE "pg_upgrade_server.log" |
#define | UTILITY_LOG_FILE "pg_upgrade_utility.log" |
#define | INTERNAL_LOG_FILE "pg_upgrade_internal.log" |
#define | SERVER_START_LOG_FILE SERVER_LOG_FILE |
#define | SERVER_STOP_LOG_FILE SERVER_LOG_FILE |
#define | pg_mv_file rename |
#define | PATH_SEPARATOR '/' |
#define | PATH_QUOTE '\'' |
#define | RM_CMD "rm -f" |
#define | RMDIR_CMD "rm -rf" |
#define | SCRIPT_PREFIX "./" |
#define | SCRIPT_EXT "sh" |
#define | ECHO_QUOTE "'" |
#define | ECHO_BLANK "" |
#define | BINARY_UPGRADE_SERVER_FLAG_CAT_VER 201104251 |
#define | VISIBILITY_MAP_CRASHSAFE_CAT_VER 201107031 |
#define | VISIBILITY_MAP_FROZEN_BIT_CAT_VER 201603011 |
#define | MULTIXACT_FORMATCHANGE_CAT_VER 201301231 |
#define | LARGE_OBJECT_SIZE_PG_CONTROL_VER 942 |
#define | JSONB_FORMAT_CHANGE_CAT_VER 201409291 |
#define | EXEC_PSQL_ARGS "--echo-queries --set ON_ERROR_STOP=on --no-psqlrc --dbname=template1" |
#define | fopen_priv(path, mode) fopen(path, mode) |
Typedefs | |
typedef long | pgpid_t |
Enumerations | |
enum | transferMode { TRANSFER_MODE_CLONE, TRANSFER_MODE_COPY, TRANSFER_MODE_LINK } |
enum | eLogType { PG_VERBOSE, PG_STATUS, PG_REPORT, PG_WARNING, PG_FATAL } |
Functions | |
void | output_check_banner (bool live_check) |
void | check_and_dump_old_cluster (bool live_check) |
void | check_new_cluster (void) |
void | report_clusters_compatible (void) |
void | issue_warnings_and_set_wal_level (void) |
void | output_completion_banner (char *deletion_script_file_name) |
void | check_cluster_versions (void) |
void | check_cluster_compatibility (bool live_check) |
void | create_script_for_old_cluster_deletion (char **deletion_script_file_name) |
void | get_control_data (ClusterInfo *cluster, bool live_check) |
void | check_control_data (ControlData *oldctrl, ControlData *newctrl) |
void | disable_old_cluster (void) |
void | generate_old_dump (void) |
bool | exec_prog (const char *log_file, const char *opt_log_file, bool report_error, bool exit_on_error, const char *fmt,...) pg_attribute_printf(5 |
bool void | verify_directories (void) |
bool | pid_lock_file_exists (const char *datadir) |
void | cloneFile (const char *src, const char *dst, const char *schemaName, const char *relName) |
void | copyFile (const char *src, const char *dst, const char *schemaName, const char *relName) |
void | linkFile (const char *src, const char *dst, const char *schemaName, const char *relName) |
void | rewriteVisibilityMap (const char *fromfile, const char *tofile, const char *schemaName, const char *relName) |
void | check_file_clone (void) |
void | check_hard_link (void) |
void | get_loadable_libraries (void) |
void | check_loadable_libraries (void) |
FileNameMap * | gen_db_file_maps (DbInfo *old_db, DbInfo *new_db, int *nmaps, const char *old_pgdata, const char *new_pgdata) |
void | get_db_and_rel_infos (ClusterInfo *cluster) |
void | print_maps (FileNameMap *maps, int n, const char *db_name) |
void | parseCommandLine (int argc, char *argv[]) |
void | adjust_data_dir (ClusterInfo *cluster) |
void | get_sock_dir (ClusterInfo *cluster, bool live_check) |
void | transfer_all_new_tablespaces (DbInfoArr *old_db_arr, DbInfoArr *new_db_arr, char *old_pgdata, char *new_pgdata) |
void | transfer_all_new_dbs (DbInfoArr *old_db_arr, DbInfoArr *new_db_arr, char *old_pgdata, char *new_pgdata, char *old_tablespace) |
void | init_tablespaces (void) |
PGconn * | connectToServer (ClusterInfo *cluster, const char *db_name) |
PGresult * | executeQueryOrDie (PGconn *conn, const char *fmt,...) pg_attribute_printf(2 |
PGresult char * | cluster_conn_opts (ClusterInfo *cluster) |
bool | start_postmaster (ClusterInfo *cluster, bool report_and_exit_on_error) |
void | stop_postmaster (bool in_atexit) |
uint32 | get_major_server_version (ClusterInfo *cluster) |
void | check_pghost_envvar (void) |
char * | quote_identifier (const char *s) |
int | get_user_info (char **user_name_p) |
void | check_ok (void) |
void | report_status (eLogType type, const char *fmt,...) pg_attribute_printf(2 |
void void | pg_log (eLogType type, const char *fmt,...) pg_attribute_printf(2 |
void void void | pg_fatal (const char *fmt,...) pg_attribute_printf(1 |
void void void | pg_attribute_noreturn () |
void | end_progress_output (void) |
void | prep_status (const char *fmt,...) pg_attribute_printf(1 |
unsigned int | str2uint (const char *str) |
void | new_9_0_populate_pg_largeobject_metadata (ClusterInfo *cluster, bool check_mode) |
void | old_9_3_check_for_line_data_type_usage (ClusterInfo *cluster) |
void | old_9_6_check_for_unknown_data_type_usage (ClusterInfo *cluster) |
void | old_9_6_invalidate_hash_indexes (ClusterInfo *cluster, bool check_mode) |
void | old_11_check_for_sql_identifier_data_type_usage (ClusterInfo *cluster) |
void | parallel_exec_prog (const char *log_file, const char *opt_log_file, const char *fmt,...) pg_attribute_printf(3 |
void void | parallel_transfer_all_new_dbs (DbInfoArr *old_db_arr, DbInfoArr *new_db_arr, char *old_pgdata, char *new_pgdata, char *old_tablespace) |
bool | reap_child (bool wait_for_child) |
Variables | |
char * | output_files [] |
LogOpts | log_opts |
UserOpts | user_opts |
ClusterInfo | old_cluster |
ClusterInfo | new_cluster |
OSInfo | os_info |
#define BINARY_UPGRADE_SERVER_FLAG_CAT_VER 201104251 |
Definition at line 94 of file pg_upgrade.h.
Referenced by start_postmaster().
#define DB_DUMP_FILE_MASK "pg_upgrade_dump_%u.custom" |
Definition at line 27 of file pg_upgrade.h.
Referenced by cleanup(), create_new_objects(), and generate_old_dump().
#define DB_DUMP_LOG_FILE_MASK "pg_upgrade_dump_%u.log" |
Definition at line 29 of file pg_upgrade.h.
Referenced by cleanup(), create_new_objects(), and generate_old_dump().
#define DEF_PGUPORT 50432 |
Definition at line 16 of file pg_upgrade.h.
Referenced by check_cluster_compatibility(), get_sock_dir(), and parseCommandLine().
#define ECHO_BLANK "" |
Definition at line 75 of file pg_upgrade.h.
#define ECHO_QUOTE "'" |
Definition at line 74 of file pg_upgrade.h.
#define EXEC_PSQL_ARGS "--echo-queries --set ON_ERROR_STOP=on --no-psqlrc --dbname=template1" |
Definition at line 357 of file pg_upgrade.h.
Referenced by prepare_new_globals().
Definition at line 379 of file pg_upgrade.h.
Referenced by check_for_data_type_usage(), check_for_isn_and_int8_passing_mismatch(), check_for_jsonb_9_4_usage(), check_for_reg_data_type_usage(), check_for_tables_with_oids(), check_for_user_defined_postfix_ops(), check_loadable_libraries(), create_script_for_old_cluster_deletion(), new_9_0_populate_pg_largeobject_metadata(), old_9_6_invalidate_hash_indexes(), and parseCommandLine().
#define GET_MAJOR_VERSION | ( | v | ) | ((v) / 100) |
Definition at line 23 of file pg_upgrade.h.
Referenced by check_and_dump_old_cluster(), check_bin_dir(), check_cluster_compatibility(), check_cluster_versions(), check_data_dir(), check_for_data_type_usage(), check_loadable_libraries(), copy_xact_xlog_xid(), create_new_objects(), create_script_for_old_cluster_deletion(), gen_db_file_maps(), get_control_data(), get_db_infos(), get_loadable_libraries(), get_rel_infos(), get_sock_dir(), get_tablespace_paths(), issue_warnings_and_set_wal_level(), set_tablespace_directory_suffix(), and start_postmaster().
#define GLOBALS_DUMP_FILE "pg_upgrade_dump_globals.sql" |
Definition at line 26 of file pg_upgrade.h.
Referenced by cleanup(), generate_old_dump(), prepare_new_globals(), and verify_directories().
#define INTERNAL_LOG_FILE "pg_upgrade_internal.log" |
Definition at line 32 of file pg_upgrade.h.
Referenced by parseCommandLine().
#define JSONB_FORMAT_CHANGE_CAT_VER 201409291 |
Definition at line 124 of file pg_upgrade.h.
Referenced by check_and_dump_old_cluster().
#define LARGE_OBJECT_SIZE_PG_CONTROL_VER 942 |
Definition at line 119 of file pg_upgrade.h.
Referenced by get_control_data().
#define MAX_STRING 1024 |
Definition at line 18 of file pg_upgrade.h.
Referenced by adjust_data_dir(), get_bin_version(), get_control_data(), parallel_exec_prog(), prep_status(), and report_status().
#define MESSAGE_WIDTH 60 |
Definition at line 21 of file pg_upgrade.h.
Referenced by pg_log_v(), and prep_status().
#define MULTIXACT_FORMATCHANGE_CAT_VER 201301231 |
Definition at line 113 of file pg_upgrade.h.
Referenced by copy_xact_xlog_xid(), and get_control_data().
#define PATH_QUOTE '\'' |
Definition at line 69 of file pg_upgrade.h.
Referenced by create_script_for_old_cluster_deletion().
#define PATH_SEPARATOR '/' |
Definition at line 68 of file pg_upgrade.h.
Referenced by create_script_for_old_cluster_deletion().
#define pg_mv_file rename |
Definition at line 67 of file pg_upgrade.h.
Referenced by disable_old_cluster().
#define QUERY_ALLOC 8192 |
Definition at line 19 of file pg_upgrade.h.
Referenced by executeQueryOrDie(), get_db_infos(), get_rel_infos(), get_tablespace_paths(), and pg_log_v().
#define RM_CMD "rm -f" |
Definition at line 70 of file pg_upgrade.h.
Referenced by create_script_for_old_cluster_deletion().
#define RMDIR_CMD "rm -rf" |
Definition at line 71 of file pg_upgrade.h.
Referenced by create_script_for_old_cluster_deletion().
#define SCRIPT_EXT "sh" |
Definition at line 73 of file pg_upgrade.h.
Referenced by create_script_for_old_cluster_deletion().
#define SCRIPT_PREFIX "./" |
Definition at line 72 of file pg_upgrade.h.
Referenced by create_script_for_old_cluster_deletion().
#define SERVER_LOG_FILE "pg_upgrade_server.log" |
Definition at line 30 of file pg_upgrade.h.
Referenced by start_postmaster().
#define SERVER_START_LOG_FILE SERVER_LOG_FILE |
Definition at line 53 of file pg_upgrade.h.
Referenced by start_postmaster().
#define SERVER_STOP_LOG_FILE SERVER_LOG_FILE |
Definition at line 54 of file pg_upgrade.h.
Referenced by stop_postmaster().
#define UTILITY_LOG_FILE "pg_upgrade_utility.log" |
Definition at line 31 of file pg_upgrade.h.
Referenced by copy_subdir_files(), copy_xact_xlog_xid(), generate_old_dump(), main(), prepare_new_cluster(), and prepare_new_globals().
#define VISIBILITY_MAP_CRASHSAFE_CAT_VER 201107031 |
Definition at line 100 of file pg_upgrade.h.
Referenced by transfer_single_new_db().
#define VISIBILITY_MAP_FROZEN_BIT_CAT_VER 201603011 |
Definition at line 105 of file pg_upgrade.h.
Referenced by transfer_single_new_db().
typedef long pgpid_t |
Definition at line 247 of file pg_upgrade.h.
enum eLogType |
Enumerator | |
---|---|
PG_VERBOSE | |
PG_STATUS | |
PG_REPORT | |
PG_WARNING | |
PG_FATAL |
Definition at line 237 of file pg_upgrade.h.
enum transferMode |
Enumerator | |
---|---|
TRANSFER_MODE_CLONE | |
TRANSFER_MODE_COPY | |
TRANSFER_MODE_LINK |
Definition at line 227 of file pg_upgrade.h.
void adjust_data_dir | ( | ClusterInfo * | cluster | ) |
Definition at line 411 of file option.c.
References ClusterInfo::bindir, check_ok(), filename, MAX_STRING, MAXPGPATH, old_cluster, output(), pg_fatal, pg_strdup(), pg_strip_crlf(), ClusterInfo::pgconfig, ClusterInfo::pgdata, prep_status(), snprintf, and strerror.
void check_and_dump_old_cluster | ( | bool | live_check | ) |
Definition at line 81 of file check.c.
References ControlData::cat_ver, UserOpts::check, check_for_isn_and_int8_passing_mismatch(), check_for_jsonb_9_4_usage(), check_for_pg_role_prefix(), check_for_prepared_transactions(), check_for_reg_data_type_usage(), check_for_tables_with_oids(), check_for_user_defined_postfix_ops(), check_is_install_user(), check_proper_datallowconn(), ClusterInfo::controldata, generate_old_dump(), get_db_and_rel_infos(), get_loadable_libraries(), GET_MAJOR_VERSION, init_tablespaces(), JSONB_FORMAT_CHANGE_CAT_VER, ClusterInfo::major_version, new_9_0_populate_pg_largeobject_metadata(), old_11_check_for_sql_identifier_data_type_usage(), old_9_3_check_for_line_data_type_usage(), old_9_6_check_for_unknown_data_type_usage(), old_9_6_invalidate_hash_indexes(), old_cluster, start_postmaster(), stop_postmaster(), and user_opts.
Referenced by main().
void check_cluster_compatibility | ( | bool | live_check | ) |
Definition at line 313 of file check.c.
References check_control_data(), ClusterInfo::controldata, DEF_PGUPORT, get_control_data(), GET_MAJOR_VERSION, ClusterInfo::major_version, new_cluster, old_cluster, pg_fatal, and ClusterInfo::port.
Referenced by main().
void check_cluster_versions | ( | void | ) |
Definition at line 271 of file check.c.
References Assert, ClusterInfo::bin_version, check_ok(), GET_MAJOR_VERSION, ClusterInfo::major_version, new_cluster, old_cluster, pg_fatal, and prep_status().
Referenced by main().
void check_control_data | ( | ControlData * | oldctrl, |
ControlData * | newctrl | ||
) |
Definition at line 633 of file controldata.c.
References ControlData::align, ControlData::blocksz, ControlData::data_checksum_version, ControlData::date_is_int, ControlData::ident, ControlData::index, ControlData::large_object, ControlData::largesz, pg_fatal, ControlData::toast, ControlData::walseg, and ControlData::walsz.
Referenced by check_cluster_compatibility().
void check_file_clone | ( | void | ) |
Definition at line 317 of file file.c.
References close, MAXPGPATH, new_cluster, old_cluster, PG_BINARY, pg_fatal, pg_file_create_mode, ClusterInfo::pgdata, snprintf, and strerror.
Referenced by check_new_cluster().
void check_hard_link | ( | void | ) |
Definition at line 359 of file file.c.
References link(), MAXPGPATH, new_cluster, old_cluster, pg_fatal, ClusterInfo::pgdata, snprintf, and strerror.
Referenced by check_new_cluster().
void check_loadable_libraries | ( | void | ) |
Definition at line 180 of file function.c.
References _, check_ok(), conn, connectToServer(), DbInfo::db_name, ClusterInfo::dbarr, LibraryInfo::dbnum, DbInfoArr::dbs, fopen_priv, fprintf, GET_MAJOR_VERSION, OSInfo::libraries, library_name_compare(), ClusterInfo::major_version, MAXPGPATH, LibraryInfo::name, new_cluster, OSInfo::num_libraries, old_cluster, os_info, pg_fatal, pg_log(), PG_REPORT, PGRES_COMMAND_OK, PQclear(), PQerrorMessage(), PQescapeStringConn(), PQexec(), PQfinish(), PQresultStatus(), prep_status(), qsort, snprintf, and strerror.
Referenced by check_new_cluster().
void check_new_cluster | ( | void | ) |
Definition at line 167 of file check.c.
References check_databases_are_compatible(), check_file_clone(), check_for_new_tablespace_dir(), check_for_prepared_transactions(), check_hard_link(), check_is_install_user(), check_loadable_libraries(), check_new_cluster_is_empty(), get_db_and_rel_infos(), new_cluster, UserOpts::transfer_mode, TRANSFER_MODE_CLONE, TRANSFER_MODE_COPY, TRANSFER_MODE_LINK, and user_opts.
Referenced by main().
void void check_ok | ( | void | ) |
Definition at line 171 of file util.c.
References PG_REPORT, report_status(), and generate_unaccent_rules::stdout.
void check_pghost_envvar | ( | void | ) |
Definition at line 357 of file server.c.
References _PQconninfoOption::envvar, _PQconninfoOption::keyword, pg_fatal, PQconndefaults(), PQconninfoFree(), and value.
Referenced by setup().
void cloneFile | ( | const char * | src, |
const char * | dst, | ||
const char * | schemaName, | ||
const char * | relName | ||
) |
Definition at line 38 of file file.c.
References close, PG_BINARY, pg_fatal, pg_file_create_mode, and strerror.
Referenced by transfer_relfile().
PGresult char* cluster_conn_opts | ( | ClusterInfo * | cluster | ) |
Definition at line 90 of file server.c.
References appendPQExpBuffer(), appendPQExpBufferChar(), appendPQExpBufferStr(), appendShellString(), buf, createPQExpBuffer(), PQExpBufferData::data, os_info, ClusterInfo::port, resetPQExpBuffer(), ClusterInfo::sockdir, and OSInfo::user.
Referenced by create_new_objects(), generate_old_dump(), prepare_new_cluster(), and prepare_new_globals().
PGconn* connectToServer | ( | ClusterInfo * | cluster, |
const char * | db_name | ||
) |
Definition at line 27 of file server.c.
References _, ALWAYS_SECURE_SEARCH_PATH_SQL, conn, CONNECTION_OK, executeQueryOrDie(), get_db_conn(), pg_log(), PG_REPORT, PQclear(), PQerrorMessage(), PQfinish(), PQstatus(), and printf.
Referenced by check_for_data_type_usage(), check_for_isn_and_int8_passing_mismatch(), check_for_jsonb_9_4_usage(), check_for_pg_role_prefix(), check_for_prepared_transactions(), check_for_reg_data_type_usage(), check_for_tables_with_oids(), check_for_user_defined_postfix_ops(), check_is_install_user(), check_loadable_libraries(), check_proper_datallowconn(), get_db_infos(), get_loadable_libraries(), get_rel_infos(), get_tablespace_paths(), new_9_0_populate_pg_largeobject_metadata(), old_9_6_invalidate_hash_indexes(), and set_frozenxids().
void copyFile | ( | const char * | src, |
const char * | dst, | ||
const char * | schemaName, | ||
const char * | relName | ||
) |
Definition at line 78 of file file.c.
References _dosmaperr(), close, COPY_BUF_SIZE, PG_BINARY, pg_fatal, pg_file_create_mode, pg_free(), pg_malloc(), read, strerror, and write.
Referenced by transfer_relfile().
void create_script_for_old_cluster_deletion | ( | char ** | deletion_script_file_name | ) |
Definition at line 504 of file check.c.
References canonicalize_path(), check_ok(), DbInfo::db_oid, ClusterInfo::dbarr, DbInfoArr::dbs, fix_path_separator(), fopen_priv, fprintf, GET_MAJOR_VERSION, ClusterInfo::major_version, MAXPGPATH, DbInfoArr::ndbs, new_cluster, OSInfo::num_old_tablespaces, old_cluster, OSInfo::old_tablespaces, os_info, path_is_prefix_of_path(), PATH_QUOTE, PATH_SEPARATOR, pfree(), pg_fatal, pg_free(), pg_log(), pg_strdup(), PG_WARNING, ClusterInfo::pgdata, prep_status(), psprintf(), RM_CMD, RMDIR_CMD, S_IRWXU, SCRIPT_EXT, SCRIPT_PREFIX, strerror, strlcpy(), and ClusterInfo::tablespace_suffix.
Referenced by main().
void disable_old_cluster | ( | void | ) |
Definition at line 690 of file controldata.c.
References check_ok(), MAXPGPATH, old_cluster, pg_fatal, pg_log(), pg_mv_file, PG_REPORT, ClusterInfo::pgdata, prep_status(), and snprintf.
Referenced by main().
void end_progress_output | ( | void | ) |
Definition at line 43 of file util.c.
References prep_status().
Referenced by create_new_objects(), generate_old_dump(), and transfer_all_new_tablespaces().
bool exec_prog | ( | const char * | log_file, |
const char * | opt_log_file, | ||
bool | report_error, | ||
bool | exit_on_error, | ||
const char * | fmt, | ||
... | |||
) |
Referenced by check_for_data_type_usage(), check_for_isn_and_int8_passing_mismatch(), check_for_jsonb_9_4_usage(), check_for_pg_role_prefix(), check_for_prepared_transactions(), check_for_reg_data_type_usage(), check_for_tables_with_oids(), check_for_user_defined_postfix_ops(), check_is_install_user(), check_proper_datallowconn(), get_db_infos(), get_loadable_libraries(), get_rel_infos(), get_tablespace_paths(), new_9_0_populate_pg_largeobject_metadata(), old_9_6_invalidate_hash_indexes(), and set_frozenxids().
FileNameMap* gen_db_file_maps | ( | DbInfo * | old_db, |
DbInfo * | new_db, | ||
int * | nmaps, | ||
const char * | old_pgdata, | ||
const char * | new_pgdata | ||
) |
Definition at line 39 of file info.c.
References create_rel_filename_map(), DbInfo::db_name, GET_MAJOR_VERSION, ClusterInfo::major_version, maps, RelInfoArr::nrels, RelInfo::nspname, old_cluster, pg_fatal, pg_log(), pg_malloc(), PG_WARNING, DbInfo::rel_arr, RelInfo::relname, RelInfo::reloid, RelInfoArr::rels, and report_unmatched_relation().
Referenced by transfer_all_new_dbs().
void generate_old_dump | ( | void | ) |
Definition at line 16 of file dump.c.
References appendConnStrVal(), appendPQExpBufferStr(), appendShellString(), ClusterInfo::bindir, check_ok(), cluster_conn_opts(), connstr, PQExpBufferData::data, DB_DUMP_FILE_MASK, DB_DUMP_LOG_FILE_MASK, DbInfo::db_name, DbInfo::db_oid, ClusterInfo::dbarr, DbInfoArr::dbs, end_progress_output(), exec_prog(), GLOBALS_DUMP_FILE, UserOpts::ind_coll_unknown, initPQExpBuffer(), log_opts, MAXPGPATH, DbInfoArr::ndbs, new_cluster, old_cluster, parallel_exec_prog(), pg_log(), PG_STATUS, prep_status(), reap_child(), snprintf, termPQExpBuffer(), user_opts, UTILITY_LOG_FILE, and LogOpts::verbose.
Referenced by check_and_dump_old_cluster().
void get_control_data | ( | ClusterInfo * | cluster, |
bool | live_check | ||
) |
Definition at line 34 of file controldata.c.
References ControlData::align, ClusterInfo::bin_version, ClusterInfo::bindir, ControlData::blocksz, ControlData::cat_ver, ControlData::chkpnt_nxtepoch, ControlData::chkpnt_nxtmulti, ControlData::chkpnt_nxtmxoff, ControlData::chkpnt_nxtoid, ControlData::chkpnt_nxtxid, ControlData::chkpnt_oldstMulti, ClusterInfo::controldata, ControlData::ctrl_ver, ControlData::data_checksum_version, ControlData::date_is_int, ControlData::float8_pass_by_value, GET_MAJOR_VERSION, ControlData::ident, ControlData::index, ControlData::large_object, LARGE_OBJECT_SIZE_PG_CONTROL_VER, ControlData::largesz, lc_collate, lc_ctype, lc_messages, lc_monetary, lc_numeric, lc_time, ClusterInfo::major_version, MAX_STRING, MAXPGPATH, MULTIXACT_FORMATCHANGE_CAT_VER, new_cluster, ControlData::nextxlogfile, old_cluster, output(), pg_fatal, pg_free(), pg_log(), PG_REPORT, pg_strdup(), PG_VERBOSE, ClusterInfo::pgdata, setenv, snprintf, generate_unaccent_rules::stdout, str2uint(), strerror, strlcpy(), ControlData::toast, unsetenv, ControlData::walseg, and ControlData::walsz.
Referenced by check_cluster_compatibility().
void get_db_and_rel_infos | ( | ClusterInfo * | cluster | ) |
Definition at line 309 of file info.c.
References ClusterInfo::dbarr, DbInfoArr::dbs, free_db_and_rel_infos(), get_db_infos(), get_rel_infos(), log_opts, DbInfoArr::ndbs, old_cluster, pg_log(), PG_VERBOSE, print_db_infos(), and LogOpts::verbose.
Referenced by check_and_dump_old_cluster(), check_new_cluster(), and create_new_objects().
void get_loadable_libraries | ( | void | ) |
Definition at line 53 of file function.c.
References conn, connectToServer(), DbInfo::db_name, ClusterInfo::dbarr, LibraryInfo::dbnum, DbInfoArr::dbs, executeQueryOrDie(), FirstNormalObjectId, GET_MAJOR_VERSION, OSInfo::libraries, ClusterInfo::major_version, LibraryInfo::name, DbInfoArr::ndbs, OSInfo::num_libraries, old_cluster, os_info, pg_fatal, pg_free(), pg_log(), pg_malloc(), pg_strdup(), PG_WARNING, PQclear(), PQfinish(), PQgetvalue(), and PQntuples().
Referenced by check_and_dump_old_cluster().
uint32 get_major_server_version | ( | ClusterInfo * | cluster | ) |
Definition at line 157 of file server.c.
References ClusterInfo::major_version_str, MAXPGPATH, pg_fatal, ClusterInfo::pgdata, and snprintf.
Referenced by check_data_dir().
void get_sock_dir | ( | ClusterInfo * | cluster, |
bool | live_check | ||
) |
Definition at line 476 of file option.c.
References DEF_PGUPORT, filename, GET_MAJOR_VERSION, LOCK_FILE_LINE_PORT, LOCK_FILE_LINE_SOCKET_DIR, ClusterInfo::major_version, Max, MAXPGPATH, old_cluster, pg_fatal, pg_log(), pg_strdup(), pg_strip_crlf(), PG_WARNING, ClusterInfo::pgdata, ClusterInfo::port, snprintf, ClusterInfo::sockdir, UserOpts::socketdir, and strerror.
Referenced by main().
int get_user_info | ( | char ** | user_name_p | ) |
Definition at line 211 of file util.c.
References get_user_name(), pg_fatal(), and pg_strdup().
Referenced by parseCommandLine().
void init_tablespaces | ( | void | ) |
Definition at line 19 of file tablespace.c.
References get_tablespace_paths(), new_cluster, OSInfo::num_old_tablespaces, old_cluster, os_info, pg_fatal, set_tablespace_directory_suffix(), and ClusterInfo::tablespace_suffix.
Referenced by check_and_dump_old_cluster().
void issue_warnings_and_set_wal_level | ( | void | ) |
Definition at line 214 of file check.c.
References GET_MAJOR_VERSION, ClusterInfo::major_version, new_9_0_populate_pg_largeobject_metadata(), new_cluster, old_9_6_invalidate_hash_indexes(), old_cluster, start_postmaster(), and stop_postmaster().
Referenced by main().
void linkFile | ( | const char * | src, |
const char * | dst, | ||
const char * | schemaName, | ||
const char * | relName | ||
) |
void new_9_0_populate_pg_largeobject_metadata | ( | ClusterInfo * | cluster, |
bool | check_mode | ||
) |
Definition at line 22 of file version.c.
References appendPsqlMetaConnect(), check_ok(), conn, connectToServer(), PQExpBufferData::data, DbInfo::db_name, ClusterInfo::dbarr, DbInfoArr::dbs, executeQueryOrDie(), fopen_priv, fprintf, initPQExpBuffer(), MAXPGPATH, DbInfoArr::ndbs, pg_fatal, pg_log(), PG_WARNING, PQclear(), PQfinish(), PQfnumber(), PQgetvalue(), prep_status(), report_status(), snprintf, strerror, and termPQExpBuffer().
Referenced by check_and_dump_old_cluster(), and issue_warnings_and_set_wal_level().
void old_11_check_for_sql_identifier_data_type_usage | ( | ClusterInfo * | cluster | ) |
Definition at line 414 of file version.c.
References check_for_data_type_usage(), check_ok(), MAXPGPATH, pg_fatal, pg_log(), PG_REPORT, prep_status(), and snprintf.
Referenced by check_and_dump_old_cluster().
void old_9_3_check_for_line_data_type_usage | ( | ClusterInfo * | cluster | ) |
Definition at line 235 of file version.c.
References check_for_data_type_usage(), check_ok(), MAXPGPATH, pg_fatal, pg_log(), PG_REPORT, prep_status(), and snprintf.
Referenced by check_and_dump_old_cluster().
void old_9_6_check_for_unknown_data_type_usage | ( | ClusterInfo * | cluster | ) |
Definition at line 272 of file version.c.
References check_for_data_type_usage(), check_ok(), MAXPGPATH, pg_fatal, pg_log(), PG_REPORT, prep_status(), and snprintf.
Referenced by check_and_dump_old_cluster().
void old_9_6_invalidate_hash_indexes | ( | ClusterInfo * | cluster, |
bool | check_mode | ||
) |
Definition at line 299 of file version.c.
References appendPsqlMetaConnect(), check_ok(), conn, connectToServer(), PQExpBufferData::data, DbInfo::db_name, ClusterInfo::dbarr, DbInfoArr::dbs, executeQueryOrDie(), fopen_priv, fprintf, initPQExpBuffer(), DbInfoArr::ndbs, pg_fatal, pg_log(), PG_WARNING, PQclear(), PQfinish(), PQfnumber(), PQgetvalue(), PQntuples(), prep_status(), quote_identifier(), report_status(), strerror, and termPQExpBuffer().
Referenced by check_and_dump_old_cluster(), and issue_warnings_and_set_wal_level().
void output_check_banner | ( | bool | live_check | ) |
Definition at line 63 of file check.c.
References UserOpts::check, pg_log(), PG_REPORT, and user_opts.
Referenced by main().
void output_completion_banner | ( | char * | deletion_script_file_name | ) |
Definition at line 237 of file check.c.
References appendPQExpBufferChar(), appendPQExpBufferStr(), appendShellString(), ClusterInfo::bindir, PQExpBufferData::data, initPQExpBuffer(), new_cluster, os_info, pg_log(), PG_REPORT, termPQExpBuffer(), OSInfo::user, and OSInfo::user_specified.
Referenced by main().
void parallel_exec_prog | ( | const char * | log_file, |
const char * | opt_log_file, | ||
const char * | fmt, | ||
... | |||
) |
void void parallel_transfer_all_new_dbs | ( | DbInfoArr * | old_db_arr, |
DbInfoArr * | new_db_arr, | ||
char * | old_pgdata, | ||
char * | new_pgdata, | ||
char * | old_tablespace | ||
) |
Definition at line 175 of file parallel.c.
References generate_unaccent_rules::args, i, UserOpts::jobs, parallel_jobs, pg_fatal, pg_free(), pg_malloc(), pg_malloc0(), pg_strdup(), reap_child(), strerror, transfer_all_new_dbs(), and user_opts.
Referenced by transfer_all_new_tablespaces().
void parseCommandLine | ( | int | argc, |
char * | argv[] | ||
) |
Definition at line 39 of file option.c.
References _, ClusterInfo::bindir, canonicalize_path(), UserOpts::check, check_required_directory(), DEF_PGUPORT, filename, FIX_DEFAULT_READ_ONLY, fopen_priv, fprintf, free, get_progname(), get_user_info(), getopt_long(), UserOpts::ind_coll_unknown, LogOpts::internal, INTERNAL_LOG_FILE, UserOpts::jobs, log_opts, MAXPGPATH, new_cluster, no_argument, old_cluster, optarg, optind, os_info, output_files, path_is_prefix_of_path(), pfree(), pg_fatal, pg_free(), pg_log(), PG_REPORT, pg_strdup(), ClusterInfo::pgdata, ClusterInfo::pgopts, ClusterInfo::port, OSInfo::progname, psprintf(), required_argument, LogOpts::retain, setenv, UserOpts::socketdir, strlcpy(), UserOpts::transfer_mode, TRANSFER_MODE_CLONE, TRANSFER_MODE_COPY, TRANSFER_MODE_LINK, usage(), OSInfo::user, OSInfo::user_specified, and LogOpts::verbose.
Referenced by main().
void void void pg_attribute_noreturn | ( | ) |
void void void pg_fatal | ( | const char * | fmt, |
... | |||
) |
void void pg_log | ( | eLogType | type, |
const char * | fmt, | ||
... | |||
) |
Referenced by check_for_isn_and_int8_passing_mismatch(), check_for_jsonb_9_4_usage(), check_for_reg_data_type_usage(), check_for_tables_with_oids(), check_for_user_defined_postfix_ops(), check_loadable_libraries(), connectToServer(), create_new_objects(), create_script_for_old_cluster_deletion(), disable_old_cluster(), exec_prog(), executeQueryOrDie(), gen_db_file_maps(), generate_old_dump(), get_control_data(), get_db_and_rel_infos(), get_loadable_libraries(), get_sock_dir(), main(), new_9_0_populate_pg_largeobject_metadata(), old_11_check_for_sql_identifier_data_type_usage(), old_9_3_check_for_line_data_type_usage(), old_9_6_check_for_unknown_data_type_usage(), old_9_6_invalidate_hash_indexes(), output_check_banner(), output_completion_banner(), parseCommandLine(), print_db_infos(), print_maps(), print_rel_infos(), report_clusters_compatible(), report_unmatched_relation(), start_postmaster(), transfer_all_new_tablespaces(), and transfer_relfile().
bool pid_lock_file_exists | ( | const char * | datadir | ) |
void prep_status | ( | const char * | fmt, |
... | |||
) |
Referenced by adjust_data_dir(), check_cluster_versions(), check_for_isn_and_int8_passing_mismatch(), check_for_jsonb_9_4_usage(), check_for_new_tablespace_dir(), check_for_pg_role_prefix(), check_for_prepared_transactions(), check_for_reg_data_type_usage(), check_for_tables_with_oids(), check_for_user_defined_postfix_ops(), check_is_install_user(), check_loadable_libraries(), check_proper_datallowconn(), copy_subdir_files(), copy_xact_xlog_xid(), create_new_objects(), create_script_for_old_cluster_deletion(), disable_old_cluster(), generate_old_dump(), main(), new_9_0_populate_pg_largeobject_metadata(), old_11_check_for_sql_identifier_data_type_usage(), old_9_3_check_for_line_data_type_usage(), old_9_6_check_for_unknown_data_type_usage(), old_9_6_invalidate_hash_indexes(), prepare_new_cluster(), prepare_new_globals(), remove_new_subdir(), and set_frozenxids().
void print_maps | ( | FileNameMap * | maps, |
int | n, | ||
const char * | db_name | ||
) |
Definition at line 283 of file info.c.
References log_opts, pg_log(), PG_VERBOSE, relname, and LogOpts::verbose.
Referenced by transfer_all_new_dbs().
char* quote_identifier | ( | const char * | s | ) |
Definition at line 10935 of file ruleutils.c.
Definition at line 284 of file parallel.c.
References UserOpts::jobs, parallel_jobs, pg_fatal, strerror, and user_opts.
Referenced by create_new_objects(), generate_old_dump(), parallel_exec_prog(), parallel_transfer_all_new_dbs(), and transfer_all_new_tablespaces().
void report_clusters_compatible | ( | void | ) |
Definition at line 197 of file check.c.
References UserOpts::check, pg_log(), PG_REPORT, stop_postmaster(), and user_opts.
Referenced by main().
void report_status | ( | eLogType | type, |
const char * | fmt, | ||
... | |||
) |
void rewriteVisibilityMap | ( | const char * | fromfile, |
const char * | tofile, | ||
const char * | schemaName, | ||
const char * | relName | ||
) |
Definition at line 173 of file file.c.
References BITS_PER_BYTE, BITS_PER_HEAPBLOCK, byte, close, ClusterInfo::controldata, PGAlignedBlock::data, ControlData::data_checksum_version, fstat, i, new_cluster, PG_BINARY, pg_checksum_page(), pg_fatal, pg_file_create_mode, read, SizeOfPageHeaderData, stat::st_size, strerror, VISIBILITYMAP_ALL_VISIBLE, and write.
Referenced by transfer_relfile().
bool start_postmaster | ( | ClusterInfo * | cluster, |
bool | report_and_exit_on_error | ||
) |
Definition at line 196 of file server.c.
References BINARY_UPGRADE_SERVER_FLAG_CAT_VER, ClusterInfo::bindir, ControlData::cat_ver, cluster(), conn, CONNECTION_OK, ClusterInfo::controldata, exec_prog(), get_db_conn(), GET_MAJOR_VERSION, ClusterInfo::major_version, MAXPGPATH, new_cluster, old_cluster, os_info, pg_fatal, pg_log(), PG_REPORT, ClusterInfo::pgconfig, ClusterInfo::pgopts, ClusterInfo::port, PQerrorMessage(), PQfinish(), PQstatus(), OSInfo::running_cluster, SERVER_LOG_FILE, SERVER_START_LOG_FILE, snprintf, ClusterInfo::sockdir, and stop_postmaster_atexit().
void stop_postmaster | ( | bool | in_atexit | ) |
Definition at line 330 of file server.c.
References ClusterInfo::bindir, cluster(), exec_prog(), new_cluster, old_cluster, os_info, ClusterInfo::pgconfig, ClusterInfo::pgopts, OSInfo::running_cluster, and SERVER_STOP_LOG_FILE.
Referenced by check_and_dump_old_cluster(), issue_warnings_and_set_wal_level(), main(), report_clusters_compatible(), setup(), and stop_postmaster_atexit().
unsigned int str2uint | ( | const char * | str | ) |
void transfer_all_new_dbs | ( | DbInfoArr * | old_db_arr, |
DbInfoArr * | new_db_arr, | ||
char * | old_pgdata, | ||
char * | new_pgdata, | ||
char * | old_tablespace | ||
) |
Definition at line 86 of file relfilenode.c.
References DbInfo::db_name, DbInfoArr::dbs, gen_db_file_maps(), DbInfoArr::ndbs, pg_fatal, pg_free(), print_maps(), and transfer_single_new_db().
Referenced by parallel_transfer_all_new_dbs().
void transfer_all_new_tablespaces | ( | DbInfoArr * | old_db_arr, |
DbInfoArr * | new_db_arr, | ||
char * | old_pgdata, | ||
char * | new_pgdata | ||
) |
Definition at line 29 of file relfilenode.c.
References check_ok(), end_progress_output(), UserOpts::jobs, OSInfo::num_old_tablespaces, OSInfo::old_tablespaces, os_info, parallel_transfer_all_new_dbs(), pg_log(), PG_REPORT, reap_child(), UserOpts::transfer_mode, TRANSFER_MODE_CLONE, TRANSFER_MODE_COPY, TRANSFER_MODE_LINK, and user_opts.
Referenced by main().
bool void verify_directories | ( | void | ) |
Definition at line 250 of file exec.c.
References check_bin_dir(), check_data_dir(), close, fd(), GLOBALS_DUMP_FILE, new_cluster, old_cluster, pg_fatal, S_IRUSR, and S_IWUSR.
Referenced by setup().
LogOpts log_opts |
Definition at line 17 of file util.c.
Referenced by cleanup(), generate_old_dump(), get_db_and_rel_infos(), parseCommandLine(), prepare_new_cluster(), and print_maps().
ClusterInfo new_cluster |
Definition at line 59 of file pg_upgrade.c.
Referenced by check_bin_dir(), check_cluster_compatibility(), check_cluster_versions(), check_databases_are_compatible(), check_file_clone(), check_for_isn_and_int8_passing_mismatch(), check_hard_link(), check_is_install_user(), check_loadable_libraries(), check_new_cluster(), check_new_cluster_is_empty(), create_rel_filename_map(), create_script_for_old_cluster_deletion(), generate_old_dump(), get_control_data(), init_tablespaces(), issue_warnings_and_set_wal_level(), output_completion_banner(), parseCommandLine(), rewriteVisibilityMap(), start_postmaster(), stop_postmaster(), transfer_single_new_db(), usage(), and verify_directories().
ClusterInfo old_cluster |
Definition at line 59 of file pg_upgrade.c.
Referenced by adjust_data_dir(), check_and_dump_old_cluster(), check_cluster_compatibility(), check_cluster_versions(), check_databases_are_compatible(), check_file_clone(), check_for_isn_and_int8_passing_mismatch(), check_for_pg_role_prefix(), check_for_prepared_transactions(), check_hard_link(), check_loadable_libraries(), create_rel_filename_map(), create_script_for_old_cluster_deletion(), disable_old_cluster(), gen_db_file_maps(), generate_old_dump(), get_control_data(), get_db_and_rel_infos(), get_loadable_libraries(), get_sock_dir(), get_tablespace_paths(), init_tablespaces(), issue_warnings_and_set_wal_level(), parseCommandLine(), start_postmaster(), stop_postmaster(), transfer_single_new_db(), usage(), and verify_directories().
OSInfo os_info |
Definition at line 61 of file pg_upgrade.c.
Referenced by check_for_new_tablespace_dir(), check_is_install_user(), check_loadable_libraries(), cluster_conn_opts(), create_script_for_old_cluster_deletion(), get_db_conn(), get_loadable_libraries(), get_tablespace_paths(), init_tablespaces(), output_completion_banner(), parseCommandLine(), start_postmaster(), stop_postmaster(), transfer_all_new_tablespaces(), and usage().
char* output_files[] |
Definition at line 63 of file pg_upgrade.c.
Referenced by cleanup(), and parseCommandLine().
UserOpts user_opts |
Definition at line 30 of file option.c.
Referenced by check_and_dump_old_cluster(), check_new_cluster(), generate_old_dump(), main(), output_check_banner(), parallel_exec_prog(), parallel_transfer_all_new_dbs(), reap_child(), report_clusters_compatible(), setup(), transfer_all_new_tablespaces(), and transfer_relfile().