From bb720f804c9c2c1d5457d6c56260f7f526822e0a Mon Sep 17 00:00:00 2001 From: Nathan Bossart Date: Mon, 16 Aug 2021 18:07:20 +0000 Subject: [PATCH v1 1/1] Check control file in --check mode. This enables developers to use --check mode to ensure that a given binary can run against a given data directory. If no control file exists, we skip this new check. --- src/backend/bootstrap/bootstrap.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/backend/bootstrap/bootstrap.c b/src/backend/bootstrap/bootstrap.c index 48615c0ebc..9d27dc09a7 100644 --- a/src/backend/bootstrap/bootstrap.c +++ b/src/backend/bootstrap/bootstrap.c @@ -16,6 +16,7 @@ #include #include +#include #include "access/genam.h" #include "access/heapam.h" @@ -319,6 +320,20 @@ BootstrapModeMain(int argc, char *argv[], bool check_only) CreateDataDirLockFile(false); + /* if we see a control file in check_only mode, check it, too */ + if (check_only) + { + struct stat buf; + + if (stat(XLOG_CONTROL_FILE, &buf) == 0) + LocalProcessControlFile(false); + else if (errno != ENOENT) + ereport(ERROR, + (errcode_for_file_access(), + errmsg("could not stat file \"%s\": %m", + XLOG_CONTROL_FILE))); + } + SetProcessingMode(BootstrapProcessing); IgnoreSystemIndexes = true; -- 2.16.6