PostgreSQL Source Code
git master
|
#include <unistd.h>
#include <assert.h>
#include <sys/stat.h>
#include <sys/time.h>
#include "common/relpath.h"
#include "libpq-fe.h"
Go to the source code of this file.
Data Structures | |
struct | RelInfo |
struct | RelInfoArr |
struct | LogicalSlotInfo |
struct | LogicalSlotInfoArr |
struct | FileNameMap |
struct | DbInfo |
struct | DbLocaleInfo |
struct | DbInfoArr |
struct | ControlData |
struct | ClusterInfo |
struct | LogOpts |
struct | UserOpts |
struct | LibraryInfo |
struct | OSInfo |
struct | UpgradeTaskReport |
Macros | |
#define | DEF_PGUPORT 50432 |
#define | MAX_STRING 1024 |
#define | QUERY_ALLOC 8192 |
#define | MESSAGE_WIDTH 62 |
#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 | BASE_OUTPUTDIR "pg_upgrade_output.d" |
#define | LOG_OUTPUTDIR "log" |
#define | DUMP_OUTPUTDIR "dump" |
#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 | 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 bool(* | DataTypesUsageVersionCheck) (ClusterInfo *cluster) |
typedef void(* | UpgradeTaskProcessCB) (DbInfo *dbinfo, PGresult *res, void *arg) |
typedef struct UpgradeTask | UpgradeTask |
Enumerations | |
enum | transferMode { TRANSFER_MODE_CLONE , TRANSFER_MODE_COPY , TRANSFER_MODE_COPY_FILE_RANGE , TRANSFER_MODE_LINK } |
enum | eLogType { PG_VERBOSE , PG_STATUS , PG_REPORT_NONL , PG_REPORT , PG_WARNING , PG_FATAL } |
Functions | |
void | output_check_banner (void) |
void | check_and_dump_old_cluster (void) |
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 (void) |
void | create_script_for_old_cluster_deletion (char **deletion_script_file_name) |
void | get_control_data (ClusterInfo *cluster) |
void | check_control_data (ControlData *oldctrl, ControlData *newctrl) |
void | disable_old_cluster (void) |
void | generate_old_dump (void) |
bool | exec_prog (const char *log_filename, 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 | copyFileByRange (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_copy_file_range (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_rel_and_slot_infos (ClusterInfo *cluster) |
int | count_old_cluster_logical_slots (void) |
void | get_subscription_count (ClusterInfo *cluster) |
void | parseCommandLine (int argc, char *argv[]) |
void | adjust_data_dir (ClusterInfo *cluster) |
void | get_sock_dir (ClusterInfo *cluster) |
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 | cleanup_output_dirs (void) |
void | prep_status (const char *fmt,...) pg_attribute_printf(1 |
void void | prep_status_progress (const char *fmt,...) pg_attribute_printf(1 |
void void unsigned int | str2uint (const char *str) |
bool | jsonb_9_4_check_applicable (ClusterInfo *cluster) |
void | old_9_6_invalidate_hash_indexes (ClusterInfo *cluster, bool check_mode) |
void | report_extension_updates (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) |
UpgradeTask * | upgrade_task_create (void) |
void | upgrade_task_add_step (UpgradeTask *task, const char *query, UpgradeTaskProcessCB process_cb, bool free_result, void *arg) |
void | upgrade_task_run (const UpgradeTask *task, const ClusterInfo *cluster) |
void | upgrade_task_free (UpgradeTask *task) |
Variables | |
char * | output_files [] |
LogOpts | log_opts |
UserOpts | user_opts |
ClusterInfo | old_cluster |
ClusterInfo | new_cluster |
OSInfo | os_info |
#define BASE_OUTPUTDIR "pg_upgrade_output.d" |
Definition at line 39 of file pg_upgrade.h.
#define DB_DUMP_FILE_MASK "pg_upgrade_dump_%u.custom" |
Definition at line 31 of file pg_upgrade.h.
#define DB_DUMP_LOG_FILE_MASK "pg_upgrade_dump_%u.log" |
Definition at line 43 of file pg_upgrade.h.
#define DEF_PGUPORT 50432 |
Definition at line 20 of file pg_upgrade.h.
#define DUMP_OUTPUTDIR "dump" |
Definition at line 41 of file pg_upgrade.h.
#define ECHO_BLANK "" |
Definition at line 89 of file pg_upgrade.h.
#define ECHO_QUOTE "'" |
Definition at line 88 of file pg_upgrade.h.
#define EXEC_PSQL_ARGS "--echo-queries --set ON_ERROR_STOP=on --no-psqlrc --dbname=template1" |
Definition at line 394 of file pg_upgrade.h.
Definition at line 419 of file pg_upgrade.h.
#define GET_MAJOR_VERSION | ( | v | ) | ((v) / 100) |
Definition at line 27 of file pg_upgrade.h.
#define GLOBALS_DUMP_FILE "pg_upgrade_dump_globals.sql" |
Definition at line 30 of file pg_upgrade.h.
#define INTERNAL_LOG_FILE "pg_upgrade_internal.log" |
Definition at line 46 of file pg_upgrade.h.
#define JSONB_FORMAT_CHANGE_CAT_VER 201409291 |
Definition at line 126 of file pg_upgrade.h.
#define LARGE_OBJECT_SIZE_PG_CONTROL_VER 942 |
Definition at line 121 of file pg_upgrade.h.
#define LOG_OUTPUTDIR "log" |
Definition at line 40 of file pg_upgrade.h.
#define MAX_STRING 1024 |
Definition at line 22 of file pg_upgrade.h.
#define MESSAGE_WIDTH 62 |
Definition at line 25 of file pg_upgrade.h.
#define MULTIXACT_FORMATCHANGE_CAT_VER 201301231 |
Definition at line 115 of file pg_upgrade.h.
#define PATH_QUOTE '\'' |
Definition at line 83 of file pg_upgrade.h.
#define PATH_SEPARATOR '/' |
Definition at line 82 of file pg_upgrade.h.
#define pg_mv_file rename |
Definition at line 81 of file pg_upgrade.h.
#define QUERY_ALLOC 8192 |
Definition at line 23 of file pg_upgrade.h.
#define RM_CMD "rm -f" |
Definition at line 84 of file pg_upgrade.h.
#define RMDIR_CMD "rm -rf" |
Definition at line 85 of file pg_upgrade.h.
#define SCRIPT_EXT "sh" |
Definition at line 87 of file pg_upgrade.h.
#define SCRIPT_PREFIX "./" |
Definition at line 86 of file pg_upgrade.h.
#define SERVER_LOG_FILE "pg_upgrade_server.log" |
Definition at line 44 of file pg_upgrade.h.
#define SERVER_START_LOG_FILE SERVER_LOG_FILE |
Definition at line 67 of file pg_upgrade.h.
#define SERVER_STOP_LOG_FILE SERVER_LOG_FILE |
Definition at line 68 of file pg_upgrade.h.
#define UTILITY_LOG_FILE "pg_upgrade_utility.log" |
Definition at line 45 of file pg_upgrade.h.
#define VISIBILITY_MAP_FROZEN_BIT_CAT_VER 201603011 |
Definition at line 107 of file pg_upgrade.h.
typedef bool(* DataTypesUsageVersionCheck) (ClusterInfo *cluster) |
Definition at line 355 of file pg_upgrade.h.
typedef struct UpgradeTask UpgradeTask |
Definition at line 500 of file pg_upgrade.h.
Definition at line 500 of file pg_upgrade.h.
enum eLogType |
Enumerator | |
---|---|
PG_VERBOSE | |
PG_STATUS | |
PG_REPORT_NONL | |
PG_REPORT | |
PG_WARNING | |
PG_FATAL |
Definition at line 264 of file pg_upgrade.h.
enum transferMode |
Enumerator | |
---|---|
TRANSFER_MODE_CLONE | |
TRANSFER_MODE_COPY | |
TRANSFER_MODE_COPY_FILE_RANGE | |
TRANSFER_MODE_LINK |
Definition at line 253 of file pg_upgrade.h.
void adjust_data_dir | ( | ClusterInfo * | cluster | ) |
Definition at line 404 of file option.c.
References check_ok(), cluster(), fflush(), filename, MAX_STRING, MAXPGPATH, old_cluster, output, pg_fatal, pg_strdup(), pg_strip_crlf(), prep_status(), snprintf, and wait_result_to_str().
void check_and_dump_old_cluster | ( | void | ) |
Definition at line 586 of file check.c.
References UserOpts::check, check_for_connection_status(), check_for_data_types_usage(), check_for_incompatible_polymorphics(), check_for_isn_and_int8_passing_mismatch(), check_for_pg_role_prefix(), check_for_prepared_transactions(), check_for_tables_with_oids(), check_for_user_defined_encoding_conversions(), check_for_user_defined_postfix_ops(), check_is_install_user(), check_old_cluster_for_valid_slots(), check_old_cluster_subscription_state(), generate_old_dump(), get_db_rel_and_slot_infos(), get_loadable_libraries(), GET_MAJOR_VERSION, get_subscription_count(), init_tablespaces(), UserOpts::live_check, ClusterInfo::major_version, old_9_6_invalidate_hash_indexes(), old_cluster, start_postmaster(), stop_postmaster(), and user_opts.
Referenced by main().
void check_cluster_compatibility | ( | void | ) |
Definition at line 846 of file check.c.
References check_control_data(), ClusterInfo::controldata, get_control_data(), UserOpts::live_check, new_cluster, old_cluster, pg_fatal, ClusterInfo::port, and user_opts.
Referenced by main().
void check_cluster_versions | ( | void | ) |
Definition at line 803 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 655 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_copy_file_range | ( | void | ) |
Definition at line 400 of file file.c.
References close, MAXPGPATH, new_cluster, old_cluster, PG_BINARY, pg_fatal, pg_file_create_mode, ClusterInfo::pgdata, and snprintf.
Referenced by check_new_cluster().
void check_file_clone | ( | void | ) |
Definition at line 360 of file file.c.
References close, MAXPGPATH, new_cluster, old_cluster, PG_BINARY, pg_fatal, pg_file_create_mode, ClusterInfo::pgdata, and snprintf.
Referenced by check_new_cluster().
void check_hard_link | ( | void | ) |
Definition at line 437 of file file.c.
References link(), MAXPGPATH, new_cluster, old_cluster, pg_fatal, ClusterInfo::pgdata, and snprintf.
Referenced by check_new_cluster().
void check_loadable_libraries | ( | void | ) |
Definition at line 165 of file function.c.
References _, LogOpts::basedir, check_ok(), conn, connectToServer(), DbInfo::db_name, ClusterInfo::dbarr, LibraryInfo::dbnum, DbInfoArr::dbs, fopen_priv, fprintf, OSInfo::libraries, library_name_compare(), log_opts, 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, res, and snprintf.
Referenced by check_new_cluster().
void check_new_cluster | ( | void | ) |
Definition at line 693 of file check.c.
References check_copy_file_range(), 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(), check_new_cluster_logical_replication_slots(), check_new_cluster_subscription_configuration(), get_db_rel_and_slot_infos(), new_cluster, UserOpts::transfer_mode, TRANSFER_MODE_CLONE, TRANSFER_MODE_COPY, TRANSFER_MODE_COPY_FILE_RANGE, TRANSFER_MODE_LINK, and user_opts.
Referenced by main().
void check_ok | ( | void | ) |
Definition at line 284 of file util.c.
References PG_REPORT, and report_status().
void check_pghost_envvar | ( | void | ) |
Definition at line 369 of file server.c.
References is_unixsock_path(), pg_fatal, PQconndefaults(), PQconninfoFree(), start, and value.
Referenced by setup().
void cleanup_output_dirs | ( | void | ) |
Definition at line 63 of file util.c.
References Assert, LogOpts::basedir, LogOpts::internal, log_opts, pg_check_dir(), pg_log(), PG_WARNING, LogOpts::retain, rmtree(), and LogOpts::rootdir.
Referenced by main(), and report_clusters_compatible().
void cloneFile | ( | const char * | src, |
const char * | dst, | ||
const char * | schemaName, | ||
const char * | relName | ||
) |
Definition at line 39 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 92 of file server.c.
References appendPQExpBuffer(), appendPQExpBufferChar(), appendPQExpBufferStr(), appendShellString(), buf, cluster(), createPQExpBuffer(), os_info, resetPQExpBuffer(), 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 28 of file server.c.
References _, ALWAYS_SECURE_SEARCH_PATH_SQL, cluster(), conn, CONNECTION_OK, executeQueryOrDie(), exit(), get_db_conn(), pg_log(), PG_REPORT, PQclear(), PQerrorMessage(), PQfinish(), PQstatus(), and printf.
Referenced by check_for_connection_status(), check_for_pg_role_prefix(), check_for_prepared_transactions(), check_is_install_user(), check_loadable_libraries(), check_new_cluster_logical_replication_slots(), check_new_cluster_subscription_configuration(), check_old_cluster_subscription_state(), create_logical_replication_slots(), create_new_objects(), get_db_infos(), get_subscription_count(), get_tablespace_paths(), get_template0_info(), old_9_6_invalidate_hash_indexes(), set_frozenxids(), and set_locale_and_encoding().
void copyFile | ( | const char * | src, |
const char * | dst, | ||
const char * | schemaName, | ||
const char * | relName | ||
) |
Definition at line 82 of file file.c.
References _dosmaperr(), close, COPY_BUF_SIZE, PG_BINARY, pg_fatal, pg_file_create_mode, pg_free(), pg_malloc(), read, and write.
Referenced by transfer_relfile().
void copyFileByRange | ( | const char * | src, |
const char * | dst, | ||
const char * | schemaName, | ||
const char * | relName | ||
) |
Definition at line 151 of file file.c.
References close, PG_BINARY, pg_fatal, and pg_file_create_mode.
Referenced by transfer_relfile().
int count_old_cluster_logical_slots | ( | void | ) |
Definition at line 742 of file info.c.
References ClusterInfo::dbarr, DbInfoArr::dbs, DbInfoArr::ndbs, LogicalSlotInfoArr::nslots, old_cluster, and DbInfo::slot_arr.
Referenced by check_new_cluster_logical_replication_slots(), get_loadable_libraries(), and main().
void create_script_for_old_cluster_deletion | ( | char ** | deletion_script_file_name | ) |
Definition at line 921 of file check.c.
References canonicalize_path(), check_ok(), DbInfo::db_oid, ClusterInfo::dbarr, DbInfoArr::dbs, fix_path_separator(), fopen_priv, fprintf, 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(), RMDIR_CMD, S_IRWXU, SCRIPT_EXT, SCRIPT_PREFIX, strlcpy(), and ClusterInfo::tablespace_suffix.
Referenced by main().
void disable_old_cluster | ( | void | ) |
Definition at line 712 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 LogOpts::isatty, log_opts, MESSAGE_WIDTH, pg_log(), PG_REPORT_NONL, printf, and LogOpts::verbose.
Referenced by create_logical_replication_slots(), create_new_objects(), generate_old_dump(), and transfer_all_new_tablespaces().
bool exec_prog | ( | const char * | log_filename, |
const char * | opt_log_file, | ||
bool | report_error, | ||
bool | exit_on_error, | ||
const char * | fmt, | ||
... | |||
) |
Referenced by check_for_connection_status(), check_for_pg_role_prefix(), check_for_prepared_transactions(), check_is_install_user(), check_new_cluster_logical_replication_slots(), check_new_cluster_subscription_configuration(), check_old_cluster_subscription_state(), create_logical_replication_slots(), create_new_objects(), get_db_infos(), get_subscription_count(), get_tablespace_paths(), get_template0_info(), old_9_6_invalidate_hash_indexes(), set_frozenxids(), and set_locale_and_encoding().
FileNameMap* gen_db_file_maps | ( | DbInfo * | old_db, |
DbInfo * | new_db, | ||
int * | nmaps, | ||
const char * | old_pgdata, | ||
const char * | new_pgdata | ||
) |
Definition at line 45 of file info.c.
References create_rel_filename_map(), DbInfo::db_name, maps, RelInfoArr::nrels, RelInfo::nspname, 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, LogOpts::dumpdir, end_progress_output(), exec_prog(), GLOBALS_DUMP_FILE, initPQExpBuffer(), log_opts, MAXPGPATH, DbInfoArr::ndbs, new_cluster, old_cluster, parallel_exec_prog(), pg_log(), PG_STATUS, prep_status(), prep_status_progress(), reap_child(), snprintf, termPQExpBuffer(), UTILITY_LOG_FILE, and LogOpts::verbose.
Referenced by check_and_dump_old_cluster().
void get_control_data | ( | ClusterInfo * | cluster | ) |
Definition at line 36 of file controldata.c.
References cluster(), fflush(), GET_MAJOR_VERSION, LARGE_OBJECT_SIZE_PG_CONTROL_VER, lc_collate, lc_ctype, lc_messages, lc_monetary, lc_numeric, lc_time, UserOpts::live_check, MAX_STRING, MAXPGPATH, MULTIXACT_FORMATCHANGE_CAT_VER, new_cluster, old_cluster, output, pg_fatal, pg_free(), pg_log(), PG_REPORT, pg_strdup(), pg_strip_crlf(), PG_VERBOSE, setenv, snprintf, str2uint(), strlcpy(), unsetenv, user_opts, and wait_result_to_str().
Referenced by check_cluster_compatibility().
void get_db_rel_and_slot_infos | ( | ClusterInfo * | cluster | ) |
Definition at line 280 of file info.c.
References cluster(), free_db_and_rel_infos(), get_db_infos(), GET_MAJOR_VERSION, get_old_cluster_logical_slot_infos_query(), get_rel_infos_query(), get_template0_info(), log_opts, old_cluster, pg_free(), pg_log(), PG_VERBOSE, print_db_infos(), process_old_cluster_logical_slot_infos(), process_rel_infos(), upgrade_task_add_step(), upgrade_task_create(), upgrade_task_free(), upgrade_task_run(), 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 79 of file function.c.
References count_old_cluster_logical_slots(), ClusterInfo::dbarr, LibraryInfo::dbnum, DbInfoArr::dbs, FirstNormalObjectId, LogicalSlotInfo::invalid, OSInfo::libraries, LibraryInfo::name, DbInfoArr::ndbs, LogicalSlotInfoArr::nslots, OSInfo::num_libraries, old_cluster, os_info, pg_free(), pg_malloc(), pg_strdup(), LogicalSlotInfo::plugin, PQclear(), PQgetvalue(), PQntuples(), process_loadable_libraries(), psprintf(), res, DbInfo::slot_arr, LogicalSlotInfoArr::slots, loadable_libraries_state::totaltups, upgrade_task_add_step(), upgrade_task_create(), upgrade_task_free(), and upgrade_task_run().
Referenced by check_and_dump_old_cluster().
uint32 get_major_server_version | ( | ClusterInfo * | cluster | ) |
void get_sock_dir | ( | ClusterInfo * | cluster | ) |
Definition at line 473 of file option.c.
References cluster(), DEF_PGUPORT, filename, UserOpts::live_check, LOCK_FILE_LINE_PORT, LOCK_FILE_LINE_SOCKET_DIR, Max, MAXPGPATH, new_cluster, old_cluster, pg_fatal, pg_log(), pg_strdup(), pg_strip_crlf(), PG_WARNING, ClusterInfo::port, snprintf, UserOpts::socketdir, and user_opts.
Referenced by main().
void get_subscription_count | ( | ClusterInfo * | cluster | ) |
Definition at line 758 of file info.c.
References cluster(), conn, connectToServer(), executeQueryOrDie(), PQclear(), PQfinish(), PQgetvalue(), and res.
Referenced by check_and_dump_old_cluster().
int get_user_info | ( | char ** | user_name_p | ) |
Definition at line 323 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 748 of file check.c.
References GET_MAJOR_VERSION, ClusterInfo::major_version, new_cluster, old_9_6_invalidate_hash_indexes(), old_cluster, report_extension_updates(), start_postmaster(), and stop_postmaster().
Referenced by main().
bool jsonb_9_4_check_applicable | ( | ClusterInfo * | cluster | ) |
Definition at line 21 of file version.c.
References cluster(), GET_MAJOR_VERSION, and JSONB_FORMAT_CHANGE_CAT_VER.
void linkFile | ( | const char * | src, |
const char * | dst, | ||
const char * | schemaName, | ||
const char * | relName | ||
) |
void old_9_6_invalidate_hash_indexes | ( | ClusterInfo * | cluster, |
bool | check_mode | ||
) |
Definition at line 37 of file version.c.
References appendPsqlMetaConnect(), check_ok(), cluster(), conn, connectToServer(), PQExpBufferData::data, DbInfo::db_name, executeQueryOrDie(), fopen_priv, fprintf, initPQExpBuffer(), pg_fatal, pg_log(), PG_WARNING, PQclear(), PQfinish(), PQfnumber(), PQgetvalue(), PQntuples(), prep_status(), quote_identifier(), report_status(), res, and termPQExpBuffer().
Referenced by check_and_dump_old_cluster(), and issue_warnings_and_set_wal_level().
void output_check_banner | ( | void | ) |
void output_completion_banner | ( | char * | deletion_script_file_name | ) |
Definition at line 769 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 172 of file parallel.c.
References fflush(), i, UserOpts::jobs, parallel_jobs, pg_fatal, pg_free(), pg_malloc(), pg_malloc0(), pg_strdup(), reap_child(), 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, UserOpts::do_sync, exit(), FIX_DEFAULT_READ_ONLY, fprintf, free, get_progname(), get_user_info(), getopt_long(), LogOpts::isatty, UserOpts::jobs, log_opts, MAXPGPATH, new_cluster, no_argument, old_cluster, optarg, optind, os_info, parse_sync_method(), 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, generate_unaccent_rules::stdout, strlcpy(), UserOpts::sync_method, UserOpts::transfer_mode, TRANSFER_MODE_CLONE, TRANSFER_MODE_COPY, TRANSFER_MODE_COPY_FILE_RANGE, TRANSFER_MODE_LINK, usage(), OSInfo::user, user_opts, 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_connection_status(), check_for_incompatible_polymorphics(), check_for_isn_and_int8_passing_mismatch(), check_for_pg_role_prefix(), check_for_tables_with_oids(), check_for_user_defined_encoding_conversions(), check_for_user_defined_postfix_ops(), check_loadable_libraries(), check_old_cluster_for_valid_slots(), check_old_cluster_subscription_state(), connectToServer(), create_logical_replication_slots(), 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_rel_and_slot_infos(), get_sock_dir(), main(), old_9_6_invalidate_hash_indexes(), output_check_banner(), output_completion_banner(), parseCommandLine(), print_db_infos(), print_rel_infos(), print_slot_infos(), process_data_type_check(), report_clusters_compatible(), report_extension_updates(), report_unmatched_relation(), start_postmaster(), 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_connection_status(), check_for_data_types_usage(), check_for_incompatible_polymorphics(), check_for_isn_and_int8_passing_mismatch(), check_for_new_tablespace_dir(), check_for_pg_role_prefix(), check_for_prepared_transactions(), check_for_tables_with_oids(), check_for_user_defined_encoding_conversions(), check_for_user_defined_postfix_ops(), check_is_install_user(), check_loadable_libraries(), check_new_cluster_logical_replication_slots(), check_new_cluster_subscription_configuration(), check_old_cluster_for_valid_slots(), check_old_cluster_subscription_state(), copy_subdir_files(), copy_xact_xlog_xid(), create_script_for_old_cluster_deletion(), disable_old_cluster(), generate_old_dump(), main(), old_9_6_invalidate_hash_indexes(), prepare_new_cluster(), prepare_new_globals(), remove_new_subdir(), report_extension_updates(), set_frozenxids(), and set_locale_and_encoding().
void void prep_status_progress | ( | const char * | fmt, |
... | |||
) |
char* quote_identifier | ( | const char * | s | ) |
Definition at line 12868 of file ruleutils.c.
bool reap_child | ( | bool | wait_for_child | ) |
Definition at line 278 of file parallel.c.
References UserOpts::jobs, parallel_jobs, pg_fatal, res, 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 729 of file check.c.
References UserOpts::check, cleanup_output_dirs(), exit(), pg_log(), PG_REPORT, stop_postmaster(), and user_opts.
Referenced by main().
void report_extension_updates | ( | ClusterInfo * | cluster | ) |
Definition at line 179 of file version.c.
References check_ok(), cluster(), UpgradeTaskReport::file, UpgradeTaskReport::path, pg_log(), PG_REPORT, prep_status(), process_extension_updates(), report_status(), upgrade_task_add_step(), upgrade_task_create(), upgrade_task_free(), and upgrade_task_run().
Referenced by issue_warnings_and_set_wal_level().
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 216 of file file.c.
References BITS_PER_BYTE, BITS_PER_HEAPBLOCK, close, ClusterInfo::controldata, PGIOAlignedBlock::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, VISIBILITYMAP_ALL_VISIBLE, and write.
Referenced by transfer_relfile().
bool start_postmaster | ( | ClusterInfo * | cluster, |
bool | report_and_exit_on_error | ||
) |
Definition at line 198 of file server.c.
References appendPQExpBufferStr(), cluster(), conn, CONNECTION_OK, PQExpBufferData::data, exec_prog(), get_db_conn(), GET_MAJOR_VERSION, initPQExpBuffer(), log_opts, LogOpts::logdir, MAXPGPATH, new_cluster, old_cluster, os_info, pg_fatal, pg_log(), PG_REPORT, PQerrorMessage(), PQfinish(), PQstatus(), OSInfo::running_cluster, SERVER_LOG_FILE, SERVER_START_LOG_FILE, snprintf, stop_postmaster_atexit(), and termPQExpBuffer().
void stop_postmaster | ( | bool | in_atexit | ) |
Definition at line 342 of file server.c.
References cluster(), exec_prog(), new_cluster, old_cluster, os_info, 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().
void void 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 87 of file relfilenumber.c.
References DbInfo::db_name, DbInfoArr::dbs, gen_db_file_maps(), DbInfoArr::ndbs, pg_fatal, pg_free(), 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 27 of file relfilenumber.c.
References check_ok(), end_progress_output(), UserOpts::jobs, OSInfo::num_old_tablespaces, OSInfo::old_tablespaces, os_info, parallel_transfer_all_new_dbs(), prep_status_progress(), reap_child(), UserOpts::transfer_mode, TRANSFER_MODE_CLONE, TRANSFER_MODE_COPY, TRANSFER_MODE_COPY_FILE_RANGE, TRANSFER_MODE_LINK, and user_opts.
Referenced by main().
void upgrade_task_add_step | ( | UpgradeTask * | task, |
const char * | query, | ||
UpgradeTaskProcessCB | process_cb, | ||
bool | free_result, | ||
void * | arg | ||
) |
Definition at line 151 of file task.c.
References appendPQExpBuffer(), arg, UpgradeTaskStep::arg, UpgradeTaskStep::free_result, UpgradeTask::num_steps, pg_realloc(), UpgradeTaskStep::process_cb, UpgradeTask::queries, and UpgradeTask::steps.
Referenced by check_for_data_types_usage(), check_for_incompatible_polymorphics(), check_for_isn_and_int8_passing_mismatch(), check_for_tables_with_oids(), check_for_user_defined_encoding_conversions(), check_for_user_defined_postfix_ops(), check_old_cluster_subscription_state(), get_db_rel_and_slot_infos(), get_loadable_libraries(), report_extension_updates(), and upgrade_task_create().
UpgradeTask* upgrade_task_create | ( | void | ) |
Definition at line 117 of file task.c.
References ALWAYS_SECURE_SEARCH_PATH_SQL, createPQExpBuffer(), pg_malloc0(), UpgradeTask::queries, and upgrade_task_add_step().
Referenced by check_for_data_types_usage(), check_for_incompatible_polymorphics(), check_for_isn_and_int8_passing_mismatch(), check_for_tables_with_oids(), check_for_user_defined_encoding_conversions(), check_for_user_defined_postfix_ops(), check_old_cluster_subscription_state(), get_db_rel_and_slot_infos(), get_loadable_libraries(), and report_extension_updates().
void upgrade_task_free | ( | UpgradeTask * | task | ) |
Definition at line 133 of file task.c.
References destroyPQExpBuffer(), pg_free(), UpgradeTask::queries, and UpgradeTask::steps.
Referenced by check_for_data_types_usage(), check_for_incompatible_polymorphics(), check_for_isn_and_int8_passing_mismatch(), check_for_tables_with_oids(), check_for_user_defined_encoding_conversions(), check_for_user_defined_postfix_ops(), check_old_cluster_subscription_state(), get_db_rel_and_slot_infos(), get_loadable_libraries(), and report_extension_updates().
void upgrade_task_run | ( | const UpgradeTask * | task, |
const ClusterInfo * | cluster | ||
) |
Definition at line 420 of file task.c.
References cluster(), dbs_complete, dbs_processing, i, UserOpts::jobs, Max, pg_free(), pg_malloc0(), process_slot(), user_opts, and wait_on_slots().
Referenced by check_for_data_types_usage(), check_for_incompatible_polymorphics(), check_for_isn_and_int8_passing_mismatch(), check_for_tables_with_oids(), check_for_user_defined_encoding_conversions(), check_for_user_defined_postfix_ops(), check_old_cluster_subscription_state(), get_db_rel_and_slot_infos(), get_loadable_libraries(), and report_extension_updates().
bool void verify_directories | ( | void | ) |
Definition at line 263 of file exec.c.
References check_bin_dir(), check_data_dir(), new_cluster, old_cluster, and pg_fatal.
Referenced by setup().
|
extern |
Definition at line 17 of file util.c.
Referenced by check_for_connection_status(), check_for_incompatible_polymorphics(), check_for_isn_and_int8_passing_mismatch(), check_for_pg_role_prefix(), check_for_tables_with_oids(), check_for_user_defined_encoding_conversions(), check_for_user_defined_postfix_ops(), check_loadable_libraries(), check_old_cluster_for_valid_slots(), check_old_cluster_subscription_state(), cleanup_output_dirs(), create_new_objects(), end_progress_output(), exec_prog(), generate_old_dump(), get_db_rel_and_slot_infos(), make_outputdirs(), parseCommandLine(), pg_log_v(), prep_status_progress(), prepare_new_cluster(), prepare_new_globals(), process_data_type_check(), and start_postmaster().
ClusterInfo new_cluster |
Definition at line 363 of file pg_upgrade.h.
|
extern |
Definition at line 67 of file pg_upgrade.c.
Referenced by adjust_data_dir(), check_and_dump_old_cluster(), check_cluster_compatibility(), check_cluster_versions(), check_copy_file_range(), check_file_clone(), check_for_isn_and_int8_passing_mismatch(), check_for_prepared_transactions(), check_hard_link(), check_loadable_libraries(), check_new_cluster_logical_replication_slots(), check_new_cluster_subscription_configuration(), check_old_cluster_for_valid_slots(), check_old_cluster_subscription_state(), copy_subdir_files(), copy_xact_xlog_xid(), count_old_cluster_logical_slots(), create_logical_replication_slots(), create_new_objects(), create_rel_filename_map(), create_script_for_old_cluster_deletion(), disable_old_cluster(), generate_old_dump(), get_control_data(), get_db_rel_and_slot_infos(), get_loadable_libraries(), get_sock_dir(), get_tablespace_paths(), init_tablespaces(), issue_warnings_and_set_wal_level(), main(), parseCommandLine(), process_loadable_libraries(), set_frozenxids(), set_locale_and_encoding(), setup(), start_postmaster(), stop_postmaster(), transfer_single_new_db(), usage(), and verify_directories().
|
extern |
Definition at line 69 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_conn(), start_postmaster(), stop_postmaster(), transfer_all_new_tablespaces(), and usage().
|
extern |
Definition at line 71 of file pg_upgrade.c.
Referenced by make_outputdirs().
|
extern |
Definition at line 30 of file option.c.
Referenced by check_and_dump_old_cluster(), check_cluster_compatibility(), check_new_cluster(), check_old_cluster_for_valid_slots(), create_new_objects(), get_control_data(), get_old_cluster_logical_slot_infos_query(), get_sock_dir(), main(), output_check_banner(), parallel_exec_prog(), parallel_transfer_all_new_dbs(), parseCommandLine(), reap_child(), report_clusters_compatible(), setup(), transfer_all_new_tablespaces(), transfer_relfile(), and upgrade_task_run().