snprintf(pathbuf, sizeof(pathbuf), "%s/%s", path, de->d_name);
/* Skip pg_control here to back up it last */
- if (strcmp(pathbuf, "./global/pg_control") == 0)
+ if (strcmp(pathbuf, "./" XLOG_CONTROL_FILE) == 0)
continue;
if (lstat(pathbuf, &statbuf) != 0)
#endif
#include "access/xlog.h"
+#include "access/xlog_internal.h"
#include "access/xlogrecovery.h"
#include "common/file_perm.h"
#include "common/pg_prng.h"
char path[MAXPGPATH];
FILE *fp;
- snprintf(path, sizeof(path), "%s/global/pg_control", DataDir);
+ snprintf(path, sizeof(path), "%s/%s", DataDir, XLOG_CONTROL_FILE);
fp = AllocateFile(path, PG_BINARY_R);
if (fp == NULL)
#include <linux/fs.h>
#endif
+#include "access/xlog_internal.h"
#include "backup_label.h"
#include "common/checksum_helper.h"
#include "common/controldata_utils.h"
{
char *controlpath;
- controlpath = psprintf("%s/%s", prior_backup_dirs[i], "global/pg_control");
+ controlpath = psprintf("%s/%s", prior_backup_dirs[i], XLOG_CONTROL_FILE);
pg_fatal("%s: manifest system identifier is %" PRIu64 ", but control file has %" PRIu64,
controlpath,
bool crc_ok;
char *controlpath;
- controlpath = psprintf("%s/%s", backup_dirs[i], "global/pg_control");
+ controlpath = psprintf("%s/%s", backup_dirs[i], XLOG_CONTROL_FILE);
pg_log_debug("reading \"%s\"", controlpath);
control_file = get_controlfile_by_exact_path(controlpath, &crc_ok);
/*
* pg_controldata
*
- * reads the data from $PGDATA/global/pg_control
+ * reads the data from the control file located at $PGDATA/XLOG_CONTROL_FILE.
*
* license: BSD
#include <sys/stat.h>
#include <unistd.h>
+#include "access/xlog_internal.h"
#include "catalog/pg_tablespace_d.h"
#include "common/file_utils.h"
#include "common/hashfn_unstable.h"
* Don't touch the control file. It is handled specially, after copying
* all the other files.
*/
- if (strcmp(path, "global/pg_control") == 0)
+ if (strcmp(path, XLOG_CONTROL_FILE) == 0)
return FILE_ACTION_NONE;
/* Skip macOS system files */
* need to make sure by themselves that the target cluster is in a clean
* state.
*/
- buffer = slurpFile(datadir_target, "global/pg_control", &size);
+ buffer = slurpFile(datadir_target, XLOG_CONTROL_FILE, &size);
digestControlFile(&ControlFile_target, buffer, size);
pg_free(buffer);
{
ensureCleanShutdown(argv[0]);
- buffer = slurpFile(datadir_target, "global/pg_control", &size);
+ buffer = slurpFile(datadir_target, XLOG_CONTROL_FILE, &size);
digestControlFile(&ControlFile_target, buffer, size);
pg_free(buffer);
}
- buffer = source->fetch_file(source, "global/pg_control", &size);
+ buffer = source->fetch_file(source, XLOG_CONTROL_FILE, &size);
digestControlFile(&ControlFile_source, buffer, size);
pg_free(buffer);
* Fetch the control file from the source last. This ensures that the
* minRecoveryPoint is up-to-date.
*/
- buffer = source->fetch_file(source, "global/pg_control", &size);
+ buffer = source->fetch_file(source, XLOG_CONTROL_FILE, &size);
digestControlFile(&ControlFile_source_after, buffer, size);
pg_free(buffer);
#include <ctype.h>
#include <limits.h> /* for CHAR_MIN */
+#include "access/xlog_internal.h"
#include "common/string.h"
#include "pg_upgrade.h"
new_path[MAXPGPATH];
/* rename pg_control so old server cannot be accidentally started */
- prep_status("Adding \".old\" suffix to old global/pg_control");
+ prep_status("Adding \".old\" suffix to old " XLOG_CONTROL_FILE);
- snprintf(old_path, sizeof(old_path), "%s/global/pg_control", old_cluster.pgdata);
- snprintf(new_path, sizeof(new_path), "%s/global/pg_control.old", old_cluster.pgdata);
+ snprintf(old_path, sizeof(old_path), "%s/%s", old_cluster.pgdata, XLOG_CONTROL_FILE);
+ snprintf(new_path, sizeof(new_path), "%s/%s.old", old_cluster.pgdata, XLOG_CONTROL_FILE);
if (pg_mv_file(old_path, new_path) != 0)
pg_fatal("could not rename file \"%s\" to \"%s\": %m",
old_path, new_path);
if (transfer_mode == TRANSFER_MODE_LINK)
pg_log(PG_REPORT, "\n"
"If you want to start the old cluster, you will need to remove\n"
- "the \".old\" suffix from %s/global/pg_control.old.\n"
+ "the \".old\" suffix from %s/%s.old.\n"
"Because \"link\" mode was used, the old cluster cannot be safely\n"
"started once the new cluster has been started.",
- old_cluster.pgdata);
+ old_cluster.pgdata, XLOG_CONTROL_FILE);
else if (transfer_mode == TRANSFER_MODE_SWAP)
pg_log(PG_REPORT, "\n"
"Because \"swap\" mode was used, the old cluster can no longer be\n"
#include "postgres_fe.h"
+#include "access/xlog_internal.h"
#include "catalog/pg_control.h"
#include "pg_verifybackup.h"
(!mystreamer->context->skip_checksums && should_verify_checksum(m));
mystreamer->verify_control_data =
mystreamer->context->manifest->version != 1 &&
- !m->bad && strcmp(m->pathname, "global/pg_control") == 0;
+ !m->bad && strcmp(m->pathname, XLOG_CONTROL_FILE) == 0;
/* If we're going to verify the checksum, initial a checksum context. */
if (mystreamer->verify_checksum &&
pg_crc32c crc;
/* Should be here only for control file */
- Assert(strcmp(mystreamer->mfile->pathname, "global/pg_control") == 0);
+ Assert(strcmp(mystreamer->mfile->pathname, XLOG_CONTROL_FILE) == 0);
Assert(mystreamer->verify_control_data);
/*
#include <sys/stat.h>
#include <time.h>
+#include "access/xlog_internal.h"
#include "common/logging.h"
#include "common/parse_manifest.h"
#include "fe_utils/simple_list.h"
* version 1.
*/
if (context->manifest->version != 1 &&
- strcmp(relpath, "global/pg_control") == 0)
+ strcmp(relpath, XLOG_CONTROL_FILE) == 0)
verify_control_file(fullpath, context->manifest->system_identifier);
/* Update statistics for progress report, if necessary */
{
char ControlFilePath[MAXPGPATH];
- snprintf(ControlFilePath, MAXPGPATH, "%s/global/pg_control", DataDir);
+ snprintf(ControlFilePath, MAXPGPATH, "%s/%s", DataDir, XLOG_CONTROL_FILE);
return get_controlfile_by_exact_path(ControlFilePath, crc_ok_p);
}