PostgreSQL Source Code git master
|
#include "postgres_fe.h"
#include <sys/stat.h>
#include "common/file_perm.h"
#include "common/file_utils.h"
#include "common/int.h"
#include "common/logging.h"
#include "pg_upgrade.h"
Go to the source code of this file.
Macros | |
#define | SYNC_QUEUE_MAX_LEN (1024) |
Functions | |
static void | transfer_single_new_db (FileNameMap *maps, int size, char *old_tablespace) |
static void | transfer_relfile (FileNameMap *map, const char *type_suffix, bool vm_must_add_frozenbit) |
static void | sync_queue_init (void) |
static void | sync_queue_sync_all (void) |
static void | sync_queue_push (const char *fname) |
static void | sync_queue_destroy (void) |
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) |
static bool | prepare_for_swap (const char *old_tablespace, Oid db_oid, char *old_catalog_dir, char *new_db_dir, char *moved_db_dir) |
static int | FileNameMapCmp (const void *a, const void *b) |
static RelFileNumber | parse_relfilenumber (const char *filename) |
static void | swap_catalog_files (FileNameMap *maps, int size, const char *old_catalog_dir, const char *new_db_dir, const char *moved_db_dir) |
static void | do_swap (FileNameMap *maps, int size, char *old_tablespace) |
Variables | |
static char * | sync_queue [SYNC_QUEUE_MAX_LEN] |
static bool | sync_queue_inited |
static int | sync_queue_len |
#define SYNC_QUEUE_MAX_LEN (1024) |
Definition at line 42 of file relfilenumber.c.
|
static |
Definition at line 453 of file relfilenumber.c.
References FileNameMapCmp(), maps, MAXPGPATH, OSInfo::num_old_tablespaces, old_cluster, OSInfo::old_tablespaces, os_info, ClusterInfo::pgdata, prepare_for_swap(), qsort, and swap_catalog_files().
Referenced by transfer_single_new_db().
|
static |
Definition at line 316 of file relfilenumber.c.
References a, b, pg_cmp_u32(), and FileNameMap::relfilenumber.
Referenced by do_swap(), and swap_catalog_files().
|
static |
Definition at line 332 of file relfilenumber.c.
References filename, InvalidRelFileNumber, and PG_UINT32_MAX.
Referenced by swap_catalog_files().
|
static |
Definition at line 237 of file relfilenumber.c.
References MAXPGPATH, new_cluster, old_cluster, pg_dir_create_mode, pg_fatal, pg_mkdir_p(), ClusterInfo::pgdata, snprintf, stat, and ClusterInfo::tablespace_suffix.
Referenced by do_swap().
|
static |
Definition at line 363 of file relfilenumber.c.
References closedir(), dirent::d_name, generate_unaccent_rules::dest, UserOpts::do_sync, FileNameMapCmp(), fsync_fname(), fsync_parent_path(), get_dirent_type(), sort-test::key, maps, MAXPGPATH, opendir(), parse_relfilenumber(), pg_fatal, PG_LOG_ERROR, PGFILETYPE_REG, readdir(), RelFileNumberIsValid, snprintf, sync_queue_push(), and user_opts.
Referenced by do_swap().
|
inlinestatic |
Definition at line 87 of file relfilenumber.c.
References i, pfree(), sync_queue, sync_queue_inited, sync_queue_len, and SYNC_QUEUE_MAX_LEN.
Referenced by transfer_all_new_dbs().
|
inlinestatic |
Definition at line 49 of file relfilenumber.c.
References i, MAXPGPATH, palloc(), sync_queue, sync_queue_inited, and SYNC_QUEUE_MAX_LEN.
Referenced by sync_queue_push().
|
inlinestatic |
Definition at line 75 of file relfilenumber.c.
References MAXPGPATH, sync_queue, sync_queue_init(), sync_queue_len, SYNC_QUEUE_MAX_LEN, and sync_queue_sync_all().
Referenced by swap_catalog_files().
|
inlinestatic |
Definition at line 60 of file relfilenumber.c.
References fsync_fname(), i, pg_fatal, sync_queue, sync_queue_inited, and sync_queue_len.
Referenced by sync_queue_push(), and transfer_all_new_dbs().
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 171 of file relfilenumber.c.
References DbInfo::db_name, DbInfoArr::dbs, gen_db_file_maps(), DbInfoArr::ndbs, pg_fatal, pg_free(), sync_queue_destroy(), sync_queue_sync_all(), 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 108 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, TRANSFER_MODE_SWAP, and user_opts.
Referenced by main().
|
static |
Definition at line 553 of file relfilenumber.c.
References cloneFile(), copyFile(), copyFileByRange(), FileNameMap::db_oid, linkFile(), MAXPGPATH, FileNameMap::new_tablespace, FileNameMap::new_tablespace_suffix, FileNameMap::nspname, FileNameMap::old_tablespace, FileNameMap::old_tablespace_suffix, pg_fatal, pg_log(), PG_STATUS, PG_VERBOSE, FileNameMap::relfilenumber, FileNameMap::relname, rewriteVisibilityMap(), snprintf, stat::st_size, stat, UserOpts::transfer_mode, TRANSFER_MODE_CLONE, TRANSFER_MODE_COPY, TRANSFER_MODE_COPY_FILE_RANGE, TRANSFER_MODE_LINK, TRANSFER_MODE_SWAP, and user_opts.
Referenced by transfer_single_new_db().
|
static |
Definition at line 501 of file relfilenumber.c.
References Assert(), ControlData::cat_ver, ClusterInfo::controldata, do_swap(), maps, new_cluster, old_cluster, UserOpts::transfer_mode, TRANSFER_MODE_SWAP, transfer_relfile(), user_opts, and VISIBILITY_MAP_FROZEN_BIT_CAT_VER.
Referenced by transfer_all_new_dbs().
|
static |
Definition at line 44 of file relfilenumber.c.
Referenced by sync_queue_destroy(), sync_queue_init(), sync_queue_push(), and sync_queue_sync_all().
|
static |
Definition at line 45 of file relfilenumber.c.
Referenced by sync_queue_destroy(), sync_queue_init(), and sync_queue_sync_all().
|
static |
Definition at line 46 of file relfilenumber.c.
Referenced by sync_queue_destroy(), sync_queue_push(), and sync_queue_sync_all().