42#define SYNC_QUEUE_MAX_LEN (1024)
174 char *old_tablespace,
char *new_tablespace)
202 pg_fatal(
"old database \"%s\" not found in the new cluster",
384 if (
rename(path, dest) != 0)
385 pg_fatal(
"could not rename file \"%s\" to \"%s\": %m", path, dest);
411 if (
rename(path, dest) != 0)
412 pg_fatal(
"could not rename file \"%s\" to \"%s\": %m", path, dest);
496 char *old_tablespace,
char *new_tablespace)
518 do_swap(
maps, size, old_tablespace, new_tablespace);
524 if (old_tablespace ==
NULL ||
561 for (segno = 0;; segno++)
593 pg_fatal(
"error while checking for file existence \"%s.%s\" (\"%s\" to \"%s\"): %m",
void parallel_transfer_all_new_dbs(DbInfoArr *old_db_arr, DbInfoArr *new_db_arr, char *old_pgdata, char *new_pgdata, char *old_tablespace, char *new_tablespace)
bool reap_child(bool wait_for_child)
#define Assert(condition)
struct dirent * readdir(DIR *)
DIR * opendir(const char *)
void fsync_fname(const char *fname, bool isdir)
static int fsync_parent_path(const char *fname, int elevel)
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 cloneFile(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 copyFile(const char *src, const char *dst, const char *schemaName, const char *relName)
PGFileType get_dirent_type(const char *path, const struct dirent *de, bool look_through_symlinks, int elevel)
FileNameMap * gen_db_file_maps(DbInfo *old_db, DbInfo *new_db, int *nmaps, const char *old_pgdata, const char *new_pgdata)
static void check_ok(void)
static int pg_cmp_u32(uint32 a, uint32 b)
void pfree(void *pointer)
#define VISIBILITY_MAP_FROZEN_BIT_CAT_VER
void void pg_log(eLogType type, const char *fmt,...) pg_attribute_printf(2
@ TRANSFER_MODE_COPY_FILE_RANGE
void void prep_status_progress(const char *fmt,...) pg_attribute_printf(1
void void pg_noreturn void void end_progress_output(void)
int pg_mkdir_p(char *path, int omode)
#define qsort(a, b, c, d)
void transfer_all_new_tablespaces(DbInfoArr *old_db_arr, DbInfoArr *new_db_arr, char *old_pgdata, char *new_pgdata)
static bool prepare_for_swap(const char *old_tablespace, const char *new_tablespace, Oid db_oid, char *old_catalog_dir, char *new_db_dir, char *moved_db_dir)
static void do_swap(FileNameMap *maps, int size, char *old_tablespace, char *new_tablespace)
static char * sync_queue[SYNC_QUEUE_MAX_LEN]
static RelFileNumber parse_relfilenumber(const char *filename)
static void sync_queue_init(void)
static void sync_queue_destroy(void)
static void transfer_relfile(FileNameMap *map, const char *type_suffix, bool vm_must_add_frozenbit)
static int sync_queue_len
static bool sync_queue_inited
void transfer_all_new_dbs(DbInfoArr *old_db_arr, DbInfoArr *new_db_arr, char *old_pgdata, char *new_pgdata, char *old_tablespace, char *new_tablespace)
static void sync_queue_push(const char *fname)
static void swap_catalog_files(FileNameMap *maps, int size, const char *old_catalog_dir, const char *new_db_dir, const char *moved_db_dir)
#define SYNC_QUEUE_MAX_LEN
static int FileNameMapCmp(const void *a, const void *b)
static void transfer_single_new_db(FileNameMap *maps, int size, char *old_tablespace, char *new_tablespace)
static void sync_queue_sync_all(void)
#define InvalidRelFileNumber
#define RelFileNumberIsValid(relnumber)
const char * tablespace_suffix
const char * new_tablespace
const char * old_tablespace_suffix
const char * old_tablespace
RelFileNumber relfilenumber
const char * new_tablespace_suffix
transferMode transfer_mode
static const pg_conv_map maps[]