69 errmsg(
"could not open file \"%s\" for reading: %m",
72 if ((
fd = open(ControlFilePath, O_RDONLY |
PG_BINARY, 0)) == -1)
73 pg_fatal(
"could not open file \"%s\" for reading: %m",
84 errmsg(
"could not read file \"%s\": %m", ControlFilePath)));
86 pg_fatal(
"could not read file \"%s\": %m", ControlFilePath);
92 errmsg(
"could not read file \"%s\": read %d of %zu",
95 pg_fatal(
"could not read file \"%s\": read %d of %zu",
104 errmsg(
"could not close file \"%s\": %m",
108 pg_fatal(
"could not close file \"%s\": %m", ControlFilePath);
127 "The byte ordering used to store the pg_control file might not match the one\n"
128 "used by this program. In that case the results below would be incorrect, and\n"
129 "the PostgreSQL installation would be incompatible with this data directory.");
181 errmsg(
"could not open file \"%s\": %m",
184 if ((
fd = open(ControlFilePath, O_WRONLY |
PG_BINARY,
186 pg_fatal(
"could not open file \"%s\": %m", ControlFilePath);
202 errmsg(
"could not write file \"%s\": %m",
205 pg_fatal(
"could not write file \"%s\": %m", ControlFilePath);
219 errmsg(
"could not fsync file \"%s\": %m",
224 pg_fatal(
"could not fsync file \"%s\": %m", ControlFilePath);
233 errmsg(
"could not close file \"%s\": %m",
236 pg_fatal(
"could not close file \"%s\": %m", ControlFilePath);
void update_controlfile(const char *DataDir, ControlFileData *ControlFile, bool do_sync)
ControlFileData * get_controlfile(const char *DataDir, bool *crc_ok_p)
elog(ERROR, "%s: %s", p2, msg)
int errcode_for_file_access(void)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
int CloseTransientFile(int fd)
int BasicOpenFile(const char *fileName, int fileFlags)
int OpenTransientFile(const char *fileName, int fileFlags)
#define palloc_object(type)
Assert(fmt[strlen(fmt) - 1] !='\n')
#define ERRCODE_DATA_CORRUPTED
#define PG_CONTROL_FILE_SIZE
#define COMP_CRC32C(crc, data, len)
#define EQ_CRC32C(c1, c2)
#define pg_log_warning(...)
static int fd(const char *x, int i)
uint32 pg_control_version
@ WAIT_EVENT_CONTROL_FILE_WRITE_UPDATE
@ WAIT_EVENT_CONTROL_FILE_SYNC_UPDATE
static void pgstat_report_wait_start(uint32 wait_event_info)
static void pgstat_report_wait_end(void)
static ControlFileData * ControlFile
#define XLOG_CONTROL_FILE