PostgreSQL Source Code
git master
|
#include "postgres.h"
#include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <time.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) |
ControlFileData * | get_controlfile_by_exact_path (const char *ControlFilePath, 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 52 of file controldata_utils.c.
References DataDir, get_controlfile_by_exact_path(), MAXPGPATH, and snprintf.
Referenced by get_control_dbstate(), get_standby_sysid(), main(), modify_subscriber_sysid(), pg_control_checkpoint(), pg_control_init(), pg_control_recovery(), and pg_control_system().
ControlFileData* get_controlfile_by_exact_path | ( | const char * | ControlFilePath, |
bool * | crc_ok_p | ||
) |
Definition at line 68 of file controldata_utils.c.
References _, Assert, close, CloseTransientFile(), COMP_CRC32C, ControlFile, ControlFileData::crc, crc, elog, EQ_CRC32C, ereport, errcode(), ERRCODE_DATA_CORRUPTED, errcode_for_file_access(), errmsg(), ERROR, fd(), FIN_CRC32C, INIT_CRC32C, OpenTransientFile(), palloc_object, PG_BINARY, ControlFileData::pg_control_version, pg_fatal, pg_log_warning, pg_usleep(), and read.
Referenced by check_control_files(), get_controlfile(), and verify_control_file().
void update_controlfile | ( | const char * | DataDir, |
ControlFileData * | ControlFile, | ||
bool | do_sync | ||
) |
Definition at line 189 of file controldata_utils.c.
References BasicOpenFile(), close, COMP_CRC32C, ControlFile, ControlFileData::crc, crc, DataDir, do_sync, ereport, errcode_for_file_access(), errmsg(), fd(), FIN_CRC32C, fsync, INIT_CRC32C, MAXPGPATH, PANIC, PG_BINARY, PG_CONTROL_FILE_SIZE, pg_fatal, pg_file_create_mode, pg_fsync(), pgstat_report_wait_end(), pgstat_report_wait_start(), snprintf, ControlFileData::time, write, and XLOG_CONTROL_FILE.
Referenced by main(), modify_subscriber_sysid(), perform_rewind(), RewriteControlFile(), and UpdateControlFile().