|
PostgreSQL Source Code git master
|
#include "postgres.h"#include <dirent.h>#include <fcntl.h>#include <sys/stat.h>#include <sys/time.h>#include <unistd.h>#include "access/heaptoast.h"#include "access/multixact.h"#include "access/transam.h"#include "access/xlog.h"#include "access/xlog_internal.h"#include "common/controldata_utils.h"#include "common/fe_memutils.h"#include "common/file_perm.h"#include "common/logging.h"#include "common/restricted_token.h"#include "common/string.h"#include "fe_utils/option_utils.h"#include "fe_utils/version.h"#include "getopt_long.h"#include "pg_getopt.h"#include "storage/large_object.h"
Go to the source code of this file.
Macros | |
| #define | FRONTEND 1 |
| #define | ARCHSTATDIR XLOGDIR "/archive_status" |
| #define | WALSUMMARYDIR XLOGDIR "/summaries" |
| #define | WALSUMMARY_NHEXCHARS 40 |
Functions | |
| static void | CheckDataVersion (void) |
| static bool | read_controlfile (void) |
| static void | GuessControlValues (void) |
| static void | PrintControlValues (bool guessed) |
| static void | PrintNewControlValues (void) |
| static void | RewriteControlFile (void) |
| static void | FindEndOfXLOG (void) |
| static void | KillExistingXLOG (void) |
| static void | KillExistingArchiveStatus (void) |
| static void | KillExistingWALSummaries (void) |
| static void | WriteEmptyXLOG (void) |
| static void | usage (void) |
| static uint32 | strtouint32_strict (const char *restrict s, char **restrict endptr, int base) |
| static uint64 | strtouint64_strict (const char *restrict s, char **restrict endptr, int base) |
| int | main (int argc, char *argv[]) |
Variables | |
| static ControlFileData | ControlFile |
| static XLogSegNo | newXlogSegNo |
| static bool | guessed = false |
| static const char * | progname |
| static bool | next_xid_epoch_given = false |
| static uint32 | next_xid_epoch_val |
| static bool | oldest_xid_given = false |
| static TransactionId | oldest_xid_val |
| static bool | next_xid_given = false |
| static TransactionId | next_xid_val |
| static bool | commit_ts_xids_given = false |
| static TransactionId | oldest_commit_ts_xid_val |
| static TransactionId | newest_commit_ts_xid_val |
| static bool | next_oid_given = false |
| static Oid | next_oid_val |
| static bool | mxids_given = false |
| static MultiXactId | next_mxid_val |
| static MultiXactId | oldest_mxid_val = 0 |
| static bool | next_mxoff_given = false |
| static MultiXactOffset | next_mxoff_val |
| static bool | wal_segsize_given = false |
| static int | wal_segsize_val |
| static bool | char_signedness_given = false |
| static bool | char_signedness_val |
| static TimeLineID | minXlogTli = 0 |
| static XLogSegNo | minXlogSegNo = 0 |
| static int | WalSegSz |
| #define ARCHSTATDIR XLOGDIR "/archive_status" |
| #define FRONTEND 1 |
Definition at line 35 of file pg_resetwal.c.
| #define WALSUMMARY_NHEXCHARS 40 |
| #define WALSUMMARYDIR XLOGDIR "/summaries" |
|
static |
Definition at line 572 of file pg_resetwal.c.
References GET_PG_MAJORVERSION_NUM, get_pg_version(), pg_log_error, and pg_log_error_detail.
Referenced by main().
|
static |
Definition at line 950 of file pg_resetwal.c.
References ControlFileData::checkPointCopy, closedir(), ControlFile, dirent::d_name, IsPartialXLogFileName(), IsXLogFileName(), newXlogSegNo, opendir(), pg_fatal, readdir(), CheckPoint::redo, WalSegSz, XLByteToSeg, ControlFileData::xlog_seg_size, XLOGDIR, and XLogFromFileName().
Referenced by main().
|
static |
Definition at line 670 of file pg_resetwal.c.
References ControlFileData::blcksz, CATALOG_VERSION_NO, ControlFileData::catalog_version_no, ControlFileData::checkPoint, ControlFileData::checkPointCopy, ControlFile, DB_SHUTDOWNED, DEFAULT_XLOG_SEG_SIZE, FirstGenbkiObjectId, FirstMultiXactId, FirstNormalTransactionId, FirstNormalUnloggedLSN, ControlFileData::float8ByVal, ControlFileData::floatFormat, FLOATFORMAT_VALUE, CheckPoint::fullPageWrites, FullTransactionIdFromEpochAndXid(), gettimeofday(), guessed, INDEX_MAX_KEYS, ControlFileData::indexMaxKeys, InvalidOid, InvalidTransactionId, ControlFileData::loblksize, LOBLKSIZE, ControlFileData::max_locks_per_xact, ControlFileData::max_prepared_xacts, ControlFileData::max_wal_senders, ControlFileData::max_worker_processes, ControlFileData::maxAlign, ControlFileData::MaxConnections, ControlFileData::nameDataLen, NAMEDATALEN, CheckPoint::nextMulti, CheckPoint::nextMultiOffset, CheckPoint::nextOid, CheckPoint::nextXid, CheckPoint::oldestActiveXid, CheckPoint::oldestMulti, CheckPoint::oldestMultiDB, CheckPoint::oldestXid, CheckPoint::oldestXidDB, PG_CONTROL_VERSION, ControlFileData::pg_control_version, CheckPoint::PrevTimeLineID, CheckPoint::redo, ControlFileData::relseg_size, SizeOfXLogLongPHD, ControlFileData::slru_pages_per_segment, SLRU_PAGES_PER_SEGMENT, ControlFileData::state, ControlFileData::system_identifier, CheckPoint::ThisTimeLineID, CheckPoint::time, ControlFileData::time, TOAST_MAX_CHUNK_SIZE, ControlFileData::toast_max_chunk_size, ControlFileData::track_commit_timestamp, ControlFileData::unloggedLSN, ControlFileData::wal_level, WAL_LEVEL_MINIMAL, ControlFileData::wal_log_hints, ControlFileData::xlog_blcksz, and ControlFileData::xlog_seg_size.
Referenced by main().
|
static |
Definition at line 1049 of file pg_resetwal.c.
References ARCHSTATDIR, closedir(), dirent::d_name, MAXPGPATH, opendir(), pg_fatal, readdir(), snprintf, and XLOG_FNAME_LEN.
Referenced by main().
|
static |
Definition at line 1086 of file pg_resetwal.c.
References ARCHSTATDIR, closedir(), dirent::d_name, MAXPGPATH, opendir(), pg_fatal, readdir(), snprintf, WALSUMMARY_NHEXCHARS, and WALSUMMARYDIR.
Referenced by main().
|
static |
Definition at line 1016 of file pg_resetwal.c.
References closedir(), dirent::d_name, IsPartialXLogFileName(), IsXLogFileName(), MAXPGPATH, opendir(), pg_fatal, readdir(), snprintf, and XLOGDIR.
Referenced by main().
| int main | ( | int | argc, |
| char * | argv[] | ||
| ) |
Definition at line 122 of file pg_resetwal.c.
References _, char_signedness_given, char_signedness_val, CheckDataVersion(), ControlFileData::checkPointCopy, commit_ts_xids_given, ControlFile, DataDir, DB_SHUTDOWNED, ControlFileData::default_char_signedness, EpochFromFullTransactionId, fd(), FindEndOfXLOG(), FirstMultiXactId, FirstNormalTransactionId, FullTransactionIdFromEpochAndXid(), get_progname(), get_restricted_token(), GetDataDirectoryCreatePerm(), getopt_long(), GuessControlValues(), guessed, InvalidOid, InvalidTransactionId, IsValidWalSegSize, KillExistingArchiveStatus(), KillExistingWALSummaries(), KillExistingXLOG(), minXlogSegNo, minXlogTli, mxids_given, newest_commit_ts_xid_val, CheckPoint::newestCommitTsXid, newXlogSegNo, next_mxid_val, next_mxoff_given, next_mxoff_val, next_oid_given, next_oid_val, next_xid_epoch_given, next_xid_epoch_val, next_xid_given, next_xid_val, CheckPoint::nextMulti, CheckPoint::nextMultiOffset, CheckPoint::nextOid, CheckPoint::nextXid, no_argument, oldest_commit_ts_xid_val, oldest_mxid_val, oldest_xid_given, oldest_xid_val, CheckPoint::oldestCommitTsXid, CheckPoint::oldestMulti, CheckPoint::oldestMultiDB, CheckPoint::oldestXid, CheckPoint::oldestXidDB, optarg, optind, option_parse_int(), pg_fatal, pg_log_error, pg_log_error_detail, pg_log_error_hint, pg_logging_init(), pg_mode_mask, pg_strcasecmp(), pg_strdup(), PG_TEXTDOMAIN, CheckPoint::PrevTimeLineID, PrintControlValues(), printf, PrintNewControlValues(), progname, read_controlfile(), required_argument, RewriteControlFile(), set_pglocale_pgservice(), ControlFileData::state, strtouint32_strict(), strtouint64_strict(), CheckPoint::ThisTimeLineID, TransactionIdIsNormal, usage(), wal_segsize_given, wal_segsize_val, WalSegSz, WriteEmptyXLOG(), XidFromFullTransactionId, XLOG_FNAME_LEN, ControlFileData::xlog_seg_size, and XLogFromFileName().
|
static |
Definition at line 754 of file pg_resetwal.c.
References _, ControlFileData::blcksz, ControlFileData::catalog_version_no, ControlFileData::checkPointCopy, ControlFile, ControlFileData::data_checksum_version, ControlFileData::default_char_signedness, EpochFromFullTransactionId, ControlFileData::float8ByVal, CheckPoint::fullPageWrites, guessed, ControlFileData::indexMaxKeys, ControlFileData::loblksize, ControlFileData::maxAlign, ControlFileData::nameDataLen, CheckPoint::newestCommitTsXid, CheckPoint::nextMulti, CheckPoint::nextMultiOffset, CheckPoint::nextOid, CheckPoint::nextXid, CheckPoint::oldestActiveXid, CheckPoint::oldestCommitTsXid, CheckPoint::oldestMulti, CheckPoint::oldestMultiDB, CheckPoint::oldestXid, CheckPoint::oldestXidDB, ControlFileData::pg_control_version, printf, ControlFileData::relseg_size, ControlFileData::slru_pages_per_segment, ControlFileData::system_identifier, CheckPoint::ThisTimeLineID, ControlFileData::toast_max_chunk_size, XidFromFullTransactionId, ControlFileData::xlog_blcksz, and ControlFileData::xlog_seg_size.
Referenced by main().
|
static |
Definition at line 831 of file pg_resetwal.c.
References _, ControlFileData::checkPointCopy, commit_ts_xids_given, ControlFile, EpochFromFullTransactionId, MAXFNAMELEN, mxids_given, CheckPoint::newestCommitTsXid, newXlogSegNo, next_mxoff_given, next_oid_given, next_xid_epoch_given, next_xid_given, CheckPoint::nextMulti, CheckPoint::nextMultiOffset, CheckPoint::nextOid, CheckPoint::nextXid, oldest_xid_given, CheckPoint::oldestCommitTsXid, CheckPoint::oldestMulti, CheckPoint::oldestMultiDB, CheckPoint::oldestXid, CheckPoint::oldestXidDB, printf, CheckPoint::ThisTimeLineID, wal_segsize_given, WalSegSz, XidFromFullTransactionId, ControlFileData::xlog_seg_size, and XLogFileName().
Referenced by main().
|
static |
Definition at line 596 of file pg_resetwal.c.
References close, COMP_CRC32C, ControlFile, crc, EQ_CRC32C, fd(), FIN_CRC32C, guessed, INIT_CRC32C, IsValidWalSegSize, len, ngettext, PG_BINARY, PG_CONTROL_FILE_SIZE, PG_CONTROL_VERSION, pg_fatal, pg_log_error, pg_log_error_hint, pg_log_warning, pg_malloc(), read, XLOG_CONTROL_FILE, and ControlFileData::xlog_seg_size.
Referenced by main().
|
static |
Definition at line 904 of file pg_resetwal.c.
References ControlFileData::backupEndPoint, ControlFileData::backupEndRequired, ControlFileData::backupStartPoint, ControlFileData::checkPoint, ControlFileData::checkPointCopy, ControlFile, DB_SHUTDOWNED, ControlFileData::max_locks_per_xact, ControlFileData::max_prepared_xacts, ControlFileData::max_wal_senders, ControlFileData::max_worker_processes, ControlFileData::MaxConnections, ControlFileData::minRecoveryPoint, ControlFileData::minRecoveryPointTLI, newXlogSegNo, CheckPoint::redo, SizeOfXLogLongPHD, ControlFileData::state, CheckPoint::time, ControlFileData::track_commit_timestamp, update_controlfile(), ControlFileData::wal_level, WAL_LEVEL_MINIMAL, ControlFileData::wal_log_hints, WalSegSz, and XLogSegNoOffsetToRecPtr.
Referenced by main().
|
static |
Definition at line 1246 of file pg_resetwal.c.
References val.
Referenced by main().
|
static |
Definition at line 1287 of file pg_resetwal.c.
References val.
Referenced by main().
|
static |
|
static |
Definition at line 1122 of file pg_resetwal.c.
References ControlFileData::checkPointCopy, close, COMP_CRC32C, ControlFile, crc, PGAlignedXLogBlock::data, fd(), FIN_CRC32C, fsync, INIT_CRC32C, InvalidTransactionId, MAXPGPATH, newXlogSegNo, PG_BINARY, pg_fatal, pg_file_create_mode, CheckPoint::redo, SizeOfXLogLongPHD, SizeOfXLogRecord, SizeOfXLogRecordDataHeaderShort, ControlFileData::system_identifier, CheckPoint::ThisTimeLineID, WalSegSz, write, XLogRecord::xl_crc, XLogRecord::xl_info, XLogRecord::xl_prev, XLogRecord::xl_rmid, XLogRecord::xl_tot_len, XLogRecord::xl_xid, XLOG_CHECKPOINT_SHUTDOWN, XLOG_PAGE_MAGIC, XLogFilePath(), XLogPageHeaderData::xlp_info, XLP_LONG_HEADER, XLogPageHeaderData::xlp_magic, XLogPageHeaderData::xlp_pageaddr, XLogLongPageHeaderData::xlp_seg_size, XLogLongPageHeaderData::xlp_sysid, XLogPageHeaderData::xlp_tli, XLogLongPageHeaderData::xlp_xlog_blcksz, and XLR_BLOCK_ID_DATA_SHORT.
Referenced by main().
|
static |
Definition at line 97 of file pg_resetwal.c.
Referenced by main().
|
static |
Definition at line 98 of file pg_resetwal.c.
Referenced by main().
|
static |
Definition at line 80 of file pg_resetwal.c.
Referenced by main(), and PrintNewControlValues().
|
static |
Definition at line 63 of file pg_resetwal.c.
Referenced by FindEndOfXLOG(), GuessControlValues(), main(), PrintControlValues(), PrintNewControlValues(), read_controlfile(), RewriteControlFile(), and WriteEmptyXLOG().
|
static |
Definition at line 65 of file pg_resetwal.c.
Referenced by GuessControlValues(), main(), PrintControlValues(), and read_controlfile().
|
static |
Definition at line 102 of file pg_resetwal.c.
Referenced by main().
|
static |
Definition at line 101 of file pg_resetwal.c.
Referenced by main().
|
static |
Definition at line 87 of file pg_resetwal.c.
Referenced by main(), and PrintNewControlValues().
|
static |
Definition at line 82 of file pg_resetwal.c.
Referenced by main().
|
static |
Definition at line 64 of file pg_resetwal.c.
Referenced by FindEndOfXLOG(), main(), PrintNewControlValues(), RewriteControlFile(), and WriteEmptyXLOG().
|
static |
Definition at line 88 of file pg_resetwal.c.
Referenced by main().
|
static |
Definition at line 91 of file pg_resetwal.c.
Referenced by main(), and PrintNewControlValues().
|
static |
Definition at line 92 of file pg_resetwal.c.
Referenced by main().
|
static |
Definition at line 84 of file pg_resetwal.c.
Referenced by main(), and PrintNewControlValues().
|
static |
Definition at line 85 of file pg_resetwal.c.
Referenced by main().
|
static |
Definition at line 71 of file pg_resetwal.c.
Referenced by main(), and PrintNewControlValues().
|
static |
Definition at line 72 of file pg_resetwal.c.
Referenced by main().
|
static |
Definition at line 77 of file pg_resetwal.c.
Referenced by main(), and PrintNewControlValues().
|
static |
Definition at line 78 of file pg_resetwal.c.
Referenced by main().
|
static |
Definition at line 81 of file pg_resetwal.c.
Referenced by main().
|
static |
Definition at line 89 of file pg_resetwal.c.
Referenced by main().
|
static |
Definition at line 74 of file pg_resetwal.c.
Referenced by main(), and PrintNewControlValues().
|
static |
Definition at line 75 of file pg_resetwal.c.
Referenced by main().
|
static |
Definition at line 66 of file pg_resetwal.c.
|
static |
Definition at line 94 of file pg_resetwal.c.
Referenced by main(), and PrintNewControlValues().
|
static |
Definition at line 95 of file pg_resetwal.c.
Referenced by main().
|
static |
Definition at line 103 of file pg_resetwal.c.
Referenced by FindEndOfXLOG(), main(), PrintNewControlValues(), RewriteControlFile(), and WriteEmptyXLOG().