From b01fbf41f6d9d3b1fe211c8ea2a929ce36d1e658 Mon Sep 17 00:00:00 2001 From: Michael Paquier Date: Mon, 5 Feb 2018 15:01:42 +0900 Subject: [PATCH 3/5] Add backup_label, pg_internal.init and tablespace_map to pg_paths.h Those are going to be used in the list of files to be excluded from base backups which is made available to the frontends. --- src/bin/pg_ctl/pg_ctl.c | 3 ++- src/bin/pg_rewind/pg_rewind.c | 2 +- src/include/access/xlog.h | 7 ------- src/include/pg_paths.h | 17 +++++++++++++++++ src/include/utils/relcache.h | 5 ----- 5 files changed, 20 insertions(+), 14 deletions(-) diff --git a/src/bin/pg_ctl/pg_ctl.c b/src/bin/pg_ctl/pg_ctl.c index 7dc15b13b0..7f9106a527 100644 --- a/src/bin/pg_ctl/pg_ctl.c +++ b/src/bin/pg_ctl/pg_ctl.c @@ -2407,7 +2407,8 @@ main(int argc, char **argv) snprintf(version_file, MAXPGPATH, "%s/PG_VERSION", pg_data); snprintf(pid_file, MAXPGPATH, "%s/%s", pg_data, POSTMASTER_PID_FILE); - snprintf(backup_file, MAXPGPATH, "%s/backup_label", pg_data); + snprintf(backup_file, MAXPGPATH, "%s/%s", pg_data, + BACKUP_LABEL_FILE); } switch (ctl_command) diff --git a/src/bin/pg_rewind/pg_rewind.c b/src/bin/pg_rewind/pg_rewind.c index 56aabfd4af..bbd514f6f1 100644 --- a/src/bin/pg_rewind/pg_rewind.c +++ b/src/bin/pg_rewind/pg_rewind.c @@ -597,7 +597,7 @@ createBackupLabel(XLogRecPtr startpoint, TimeLineID starttli, XLogRecPtr checkpo pg_fatal("backup label buffer too small\n"); /* shouldn't happen */ /* TODO: move old file out of the way, if any. */ - open_target_file("backup_label", true); /* BACKUP_LABEL_FILE */ + open_target_file(BACKUP_LABEL_FILE, true); write_target_range(buf, 0, len); close_target_file(); } diff --git a/src/include/access/xlog.h b/src/include/access/xlog.h index 421ba6d775..ca4cbc811a 100644 --- a/src/include/access/xlog.h +++ b/src/include/access/xlog.h @@ -318,11 +318,4 @@ extern XLogRecPtr do_pg_stop_backup(char *labelfile, bool waitforarchive, extern void do_pg_abort_backup(void); extern SessionBackupState get_backup_status(void); -/* File path names (all relative to $PGDATA) */ -#define BACKUP_LABEL_FILE "backup_label" -#define BACKUP_LABEL_OLD "backup_label.old" - -#define TABLESPACE_MAP "tablespace_map" -#define TABLESPACE_MAP_OLD "tablespace_map.old" - #endif /* XLOG_H */ diff --git a/src/include/pg_paths.h b/src/include/pg_paths.h index a4746e75e4..f033f8f390 100644 --- a/src/include/pg_paths.h +++ b/src/include/pg_paths.h @@ -13,6 +13,23 @@ #ifndef PG_PATHS_H #define PG_PATHS_H +/* + * Backup label file names used in base backups. + */ +#define BACKUP_LABEL_FILE "backup_label" +#define BACKUP_LABEL_OLD "backup_label.old" + +/* + * Tablespace map files used in base backups. + */ +#define TABLESPACE_MAP "tablespace_map" +#define TABLESPACE_MAP_OLD "tablespace_map.old" + +/* + * Name of relcache init file(s), used to speed up backend startup + */ +#define RELCACHE_INIT_FILENAME "pg_internal.init" + /* * Name of files saving meta-data information about the log * files currently in use by the syslogger diff --git a/src/include/utils/relcache.h b/src/include/utils/relcache.h index 8a546aba28..7a884cb26a 100644 --- a/src/include/utils/relcache.h +++ b/src/include/utils/relcache.h @@ -18,11 +18,6 @@ #include "nodes/bitmapset.h" -/* - * Name of relcache init file(s), used to speed up backend startup - */ -#define RELCACHE_INIT_FILENAME "pg_internal.init" - typedef struct RelationData *Relation; /* ---------------- -- 2.16.1