PostgreSQL Source Code
git master
|
#include "postgres.h"
#include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "access/xlog_internal.h"
#include "catalog/pg_control.h"
#include "common/controldata_utils.h"
#include "common/file_perm.h"
#include "port/pg_crc32c.h"
#include "pgstat.h"
#include "storage/fd.h"
Go to the source code of this file.
Functions | |
ControlFileData * | get_controlfile (const char *DataDir, bool *crc_ok_p) |
void | update_controlfile (const char *DataDir, ControlFileData *ControlFile, bool do_sync) |
ControlFileData* get_controlfile | ( | const char * | DataDir, |
bool * | crc_ok_p | ||
) |
Definition at line 51 of file controldata_utils.c.
References _, AssertArg, close, CloseTransientFile(), COMP_CRC32C, ControlFile, elog, EQ_CRC32C, ereport, errcode(), ERRCODE_DATA_CORRUPTED, errcode_for_file_access(), errmsg(), ERROR, EXIT_FAILURE, fd(), FIN_CRC32C, INIT_CRC32C, MAXPGPATH, offsetof, OpenTransientFile(), palloc(), PG_BINARY, pg_log_fatal, pg_log_warning, read, and snprintf.
Referenced by get_control_dbstate(), main(), pg_control_checkpoint(), pg_control_init(), pg_control_recovery(), and pg_control_system().
void update_controlfile | ( | const char * | DataDir, |
ControlFileData * | ControlFile, | ||
bool | do_sync | ||
) |
Definition at line 156 of file controldata_utils.c.
References BasicOpenFile(), close, COMP_CRC32C, ControlFileData::crc, ereport, errcode_for_file_access(), errmsg(), EXIT_FAILURE, fd(), FIN_CRC32C, fsync, INIT_CRC32C, MAXPGPATH, offsetof, PANIC, PG_BINARY, PG_CONTROL_FILE_SIZE, PG_CONTROL_MAX_SAFE_SIZE, pg_file_create_mode, pg_fsync(), pg_log_fatal, pgstat_report_wait_end(), pgstat_report_wait_start(), snprintf, StaticAssertStmt, WAIT_EVENT_CONTROL_FILE_SYNC_UPDATE, WAIT_EVENT_CONTROL_FILE_WRITE_UPDATE, write, and XLOG_CONTROL_FILE.
Referenced by main(), perform_rewind(), RewriteControlFile(), and UpdateControlFile().