PostgreSQL Source Code
git master
|
#include "postgres_fe.h"
#include <time.h>
#include "catalog/pg_class_d.h"
#include "common/file_perm.h"
#include "common/logging.h"
#include "common/restricted_token.h"
#include "fe_utils/string_utils.h"
#include "pg_upgrade.h"
Go to the source code of this file.
Macros | |
#define | RESTORE_TRANSACTION_SIZE 1000 |
Functions | |
static void | set_locale_and_encoding (void) |
static void | prepare_new_cluster (void) |
static void | prepare_new_globals (void) |
static void | create_new_objects (void) |
static void | copy_xact_xlog_xid (void) |
static void | set_frozenxids (bool minmxid_only) |
static void | make_outputdirs (char *pgdata) |
static void | setup (char *argv0) |
static void | create_logical_replication_slots (void) |
int | main (int argc, char **argv) |
static void | remove_new_subdir (const char *subdir, bool rmtopdir) |
static void | copy_subdir_files (const char *old_subdir, const char *new_subdir) |
Variables | |
ClusterInfo | old_cluster |
ClusterInfo | new_cluster |
OSInfo | os_info |
char * | output_files [] |
#define RESTORE_TRANSACTION_SIZE 1000 |
Definition at line 55 of file pg_upgrade.c.
|
static |
Definition at line 682 of file pg_upgrade.c.
References check_ok(), exec_prog(), MAXPGPATH, new_cluster, old_cluster, ClusterInfo::pgdata, prep_status(), remove_new_subdir(), snprintf, and UTILITY_LOG_FILE.
Referenced by copy_xact_xlog_xid().
|
static |
Definition at line 707 of file pg_upgrade.c.
References ClusterInfo::bindir, ControlData::cat_ver, check_ok(), ControlData::chkpnt_nxtepoch, ControlData::chkpnt_nxtmulti, ControlData::chkpnt_nxtmxoff, ControlData::chkpnt_nxtxid, ControlData::chkpnt_oldstMulti, ControlData::chkpnt_oldstxid, ClusterInfo::controldata, copy_subdir_files(), exec_prog(), GET_MAJOR_VERSION, ClusterInfo::major_version, MULTIXACT_FORMATCHANGE_CAT_VER, new_cluster, ControlData::nextxlogfile, old_cluster, ClusterInfo::pgdata, prep_status(), remove_new_subdir(), and UTILITY_LOG_FILE.
Referenced by main().
|
static |
Definition at line 934 of file pg_upgrade.c.
References appendPQExpBuffer(), appendStringLiteralConn(), check_ok(), conn, connectToServer(), createPQExpBuffer(), PQExpBufferData::data, DbInfo::db_name, ClusterInfo::dbarr, DbInfoArr::dbs, destroyPQExpBuffer(), end_progress_output(), executeQueryOrDie(), LogicalSlotInfo::failover, DbInfoArr::ndbs, new_cluster, LogicalSlotInfoArr::nslots, old_cluster, pg_log(), PG_STATUS, LogicalSlotInfo::plugin, PQclear(), PQfinish(), prep_status_progress(), resetPQExpBuffer(), DbInfo::slot_arr, LogicalSlotInfo::slotname, LogicalSlotInfoArr::slots, and LogicalSlotInfo::two_phase.
Referenced by main().
|
static |
Definition at line 529 of file pg_upgrade.c.
References ClusterInfo::bindir, check_ok(), cluster_conn_opts(), connectToServer(), 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(), executeQueryOrDie(), get_db_rel_and_slot_infos(), GET_MAJOR_VERSION, UserOpts::jobs, log_opts, ClusterInfo::major_version, Max, MAXPGPATH, DbInfoArr::ndbs, new_cluster, old_cluster, parallel_exec_prog(), pg_log(), PG_STATUS, PQclear(), PQfinish(), prep_status_progress(), reap_child(), RESTORE_TRANSACTION_SIZE, set_frozenxids(), snprintf, and user_opts.
Referenced by main().
int main | ( | int | argc, |
char ** | argv | ||
) |
Definition at line 84 of file pg_upgrade.c.
References adjust_data_dir(), ClusterInfo::bindir, check_and_dump_old_cluster(), check_cluster_compatibility(), check_cluster_versions(), check_new_cluster(), check_ok(), ControlData::chkpnt_nxtoid, cleanup_output_dirs(), ClusterInfo::controldata, copy_xact_xlog_xid(), count_old_cluster_logical_slots(), create_logical_replication_slots(), create_new_objects(), create_script_for_old_cluster_deletion(), ClusterInfo::dbarr, disable_old_cluster(), UserOpts::do_sync, exec_prog(), get_restricted_token(), get_sock_dir(), GetDataDirectoryCreatePerm(), issue_warnings_and_set_wal_level(), make_outputdirs(), new_cluster, old_cluster, output_check_banner(), output_completion_banner(), parseCommandLine(), pg_fatal, pg_free(), pg_log(), pg_logging_init(), pg_mode_mask, PG_MODE_MASK_OWNER, PG_REPORT, PG_TEXTDOMAIN, ClusterInfo::pgdata, prep_status(), prepare_new_cluster(), prepare_new_globals(), report_clusters_compatible(), set_locale_and_encoding(), set_pglocale_pgservice(), setup(), start_postmaster(), stop_postmaster(), UserOpts::sync_method, transfer_all_new_tablespaces(), UserOpts::transfer_mode, TRANSFER_MODE_LINK, user_opts, and UTILITY_LOG_FILE.
|
static |
Definition at line 244 of file pg_upgrade.c.
References BASE_OUTPUTDIR, LogOpts::basedir, DUMP_OUTPUTDIR, LogOpts::dumpdir, filename, fopen_priv, fprintf, gettimeofday(), LogOpts::internal, INTERNAL_LOG_FILE, len, log_opts, LOG_OUTPUTDIR, LogOpts::logdir, MAXPGPATH, mkdir, output_files, pg_dir_create_mode, pg_fatal, pg_malloc0(), LogOpts::rootdir, and snprintf.
Referenced by main().
|
static |
Definition at line 477 of file pg_upgrade.c.
References ClusterInfo::bindir, check_ok(), cluster_conn_opts(), exec_prog(), log_opts, new_cluster, prep_status(), UTILITY_LOG_FILE, and LogOpts::verbose.
Referenced by main().
|
static |
Definition at line 507 of file pg_upgrade.c.
References ClusterInfo::bindir, check_ok(), cluster_conn_opts(), LogOpts::dumpdir, exec_prog(), EXEC_PSQL_ARGS, GLOBALS_DUMP_FILE, log_opts, new_cluster, prep_status(), set_frozenxids(), and UTILITY_LOG_FILE.
Referenced by main().
|
static |
Definition at line 665 of file pg_upgrade.c.
References check_ok(), MAXPGPATH, new_cluster, pg_fatal, ClusterInfo::pgdata, prep_status(), rmtree(), and snprintf.
Referenced by copy_subdir_files(), and copy_xact_xlog_xid().
|
static |
Definition at line 832 of file pg_upgrade.c.
References check_ok(), ControlData::chkpnt_nxtmulti, ControlData::chkpnt_nxtxid, conn, connectToServer(), ClusterInfo::controldata, CppAsString2, datallowconn, datname, executeQueryOrDie(), new_cluster, old_cluster, PQclear(), PQfinish(), PQfnumber(), PQgetvalue(), PQntuples(), prep_status(), and quote_identifier().
Referenced by create_new_objects(), and prepare_new_globals().
|
static |
Definition at line 400 of file pg_upgrade.c.
References check_ok(), connectToServer(), executeQueryOrDie(), GET_MAJOR_VERSION, locale, ClusterInfo::major_version, new_cluster, old_cluster, pg_strdup(), PQclear(), PQescapeLiteral(), PQfinish(), PQfreemem(), prep_status(), and ClusterInfo::template0.
Referenced by main().
|
static |
Definition at line 329 of file pg_upgrade.c.
References argv0, ClusterInfo::bindir, canonicalize_path(), UserOpts::check, check_pghost_envvar(), exec_path, find_my_exec(), last_dir_separator(), UserOpts::live_check, MAXPGPATH, new_cluster, old_cluster, pg_fatal, pg_strdup(), ClusterInfo::pgdata, pid_lock_file_exists(), start_postmaster(), stop_postmaster(), user_opts, and verify_directories().
Referenced by main().
ClusterInfo new_cluster |
Definition at line 68 of file pg_upgrade.c.
Referenced by check_bin_dir(), check_cluster_compatibility(), check_cluster_versions(), check_copy_file_range(), check_file_clone(), check_for_isn_and_int8_passing_mismatch(), check_for_new_tablespace_dir(), check_hard_link(), check_is_install_user(), check_loadable_libraries(), check_new_cluster(), check_new_cluster_is_empty(), check_new_cluster_logical_replication_slots(), check_new_cluster_subscription_configuration(), copy_subdir_files(), copy_xact_xlog_xid(), create_logical_replication_slots(), create_new_objects(), create_rel_filename_map(), create_script_for_old_cluster_deletion(), generate_old_dump(), get_control_data(), get_sock_dir(), init_tablespaces(), issue_warnings_and_set_wal_level(), main(), output_completion_banner(), parseCommandLine(), prepare_new_cluster(), prepare_new_globals(), remove_new_subdir(), rewriteVisibilityMap(), set_frozenxids(), set_locale_and_encoding(), setup(), start_postmaster(), stop_postmaster(), transfer_single_new_db(), usage(), and verify_directories().
ClusterInfo old_cluster |
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().
OSInfo os_info |
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().
char* output_files[] |
Definition at line 71 of file pg_upgrade.c.
Referenced by make_outputdirs().