PostgreSQL Source Code
git master
|
#include "postgres.h"
#include <dirent.h>
#include <limits.h>
#include <signal.h>
#include <sys/stat.h>
#include <unistd.h>
#include "access/transam.h"
#include "access/xlog_internal.h"
#include "access/xlogreader.h"
#include "access/xlogrecord.h"
#include "access/xlogstats.h"
#include "common/fe_memutils.h"
#include "common/file_perm.h"
#include "common/file_utils.h"
#include "common/logging.h"
#include "common/relpath.h"
#include "getopt_long.h"
#include "rmgrdesc.h"
#include "storage/bufpage.h"
Go to the source code of this file.
Data Structures | |
struct | XLogDumpPrivate |
struct | XLogDumpConfig |
Macros | |
#define | FRONTEND 1 |
Typedefs | |
typedef struct XLogDumpPrivate | XLogDumpPrivate |
typedef struct XLogDumpConfig | XLogDumpConfig |
Functions | |
static void | sigint_handler (SIGNAL_ARGS) |
static void | print_rmgr_list (void) |
static bool | verify_directory (const char *directory) |
static void | create_fullpage_directory (char *path) |
static void | split_path (const char *path, char **dir, char **fname) |
static int | open_file_in_directory (const char *directory, const char *fname) |
static bool | search_directory (const char *directory, const char *fname) |
static char * | identify_target_directory (char *directory, char *fname) |
static void | WALDumpOpenSegment (XLogReaderState *state, XLogSegNo nextSegNo, TimeLineID *tli_p) |
static void | WALDumpCloseSegment (XLogReaderState *state) |
static int | WALDumpReadPage (XLogReaderState *state, XLogRecPtr targetPagePtr, int reqLen, XLogRecPtr targetPtr, char *readBuff) |
static bool | XLogRecordMatchesRelationBlock (XLogReaderState *record, RelFileLocator matchRlocator, BlockNumber matchBlock, ForkNumber matchFork) |
static bool | XLogRecordHasFPW (XLogReaderState *record) |
static void | XLogRecordSaveFPWs (XLogReaderState *record, const char *savepath) |
static void | XLogDumpDisplayRecord (XLogDumpConfig *config, XLogReaderState *record) |
static void | XLogDumpStatsRow (const char *name, uint64 n, uint64 total_count, uint64 rec_len, uint64 total_rec_len, uint64 fpi_len, uint64 total_fpi_len, uint64 tot_len, uint64 total_len) |
static void | XLogDumpDisplayStats (XLogDumpConfig *config, XLogStats *stats) |
static void | usage (void) |
int | main (int argc, char **argv) |
Variables | |
static const char * | progname |
static int | WalSegSz |
static volatile sig_atomic_t | time_to_stop = false |
static const RelFileLocator | emptyRelFileLocator = {0, 0, 0} |
#define FRONTEND 1 |
Definition at line 12 of file pg_waldump.c.
typedef struct XLogDumpConfig XLogDumpConfig |
typedef struct XLogDumpPrivate XLogDumpPrivate |
|
static |
Definition at line 128 of file pg_waldump.c.
References pg_check_dir(), pg_dir_create_mode, pg_fatal, and pg_mkdir_p().
Referenced by main().
|
static |
Definition at line 292 of file pg_waldump.c.
References datadir, directory, MAXPGPATH, pg_fatal, pg_strdup(), search_directory(), snprintf, and XLOGDIR.
Referenced by main().
int main | ( | int | argc, |
char ** | argv | ||
) |
Definition at line 792 of file pg_waldump.c.
References XLogDumpConfig::already_displayed_records, XLogDumpConfig::bkp_details, BlockNumberIsValid(), close, create_fullpage_directory(), RelFileLocator::dbOid, directory, emptyRelFileLocator, XLogReaderState::EndRecPtr, exit(), EXIT_FAILURE, EXIT_SUCCESS, fd(), XLogDumpConfig::filter_by_extended, XLogDumpConfig::filter_by_fpw, XLogDumpConfig::filter_by_relation, XLogDumpConfig::filter_by_relation_block, XLogDumpConfig::filter_by_relation_block_enabled, XLogDumpConfig::filter_by_relation_enabled, XLogDumpConfig::filter_by_relation_forknum, XLogDumpConfig::filter_by_rmgr, XLogDumpConfig::filter_by_rmgr_enabled, XLogDumpConfig::filter_by_xid, XLogDumpConfig::filter_by_xid_enabled, XLogDumpConfig::follow, forkname_to_number(), get_progname(), getopt_long(), GetRmgrDesc(), identify_target_directory(), InvalidBlockNumber, InvalidForkNumber, InvalidTransactionId, InvalidXLogRecPtr, LSN_FORMAT_ARGS, ngettext, no_argument, OidIsValid, open_file_in_directory(), optarg, optind, optional_argument, pg_fatal, pg_log_error, pg_log_error_detail, pg_log_error_hint, pg_log_info, pg_logging_init(), pg_strcasecmp(), pg_strdup(), PG_TEXTDOMAIN, pg_usleep(), pqsignal(), print_rmgr_list(), progname, XLogDumpConfig::quiet, XLogReaderState::ReadRecPtr, RelFileNumberIsValid, RelFileLocator::relNumber, required_argument, RM_MAX_BUILTIN_ID, RmgrIdIsCustom(), XLogDumpConfig::save_fullpage_path, set_pglocale_pgservice(), sigint_handler(), RelFileLocator::spcOid, split_path(), XLogDumpConfig::stats, XLogDumpConfig::stats_per_record, XLogDumpConfig::stop_after_records, time_to_stop, usage(), val, verify_directory(), WALDumpCloseSegment(), WALDumpOpenSegment(), WALDumpReadPage(), WalSegSz, XLogRecord::xl_rmid, XL_ROUTINE, XLogRecord::xl_xid, XLByteInSeg, XLogDumpDisplayRecord(), XLogDumpDisplayStats(), XLogFindNextRecord(), XLogFromFileName(), XLogReaderAllocate(), XLogReaderFree(), XLogReadRecord(), XLogRecordHasFPW(), XLogRecordMatchesRelationBlock(), XLogRecordSaveFPWs(), XLogRecPtrIsInvalid, XLogRecStoreStats(), XLogSegmentOffset, and XLogSegNoOffsetToRecPtr.
|
static |
Definition at line 188 of file pg_waldump.c.
References Assert, directory, fd(), MAXPGPATH, PG_BINARY, pg_fatal, and snprintf.
Referenced by main(), search_directory(), and WALDumpOpenSegment().
|
static |
Definition at line 98 of file pg_waldump.c.
References GetRmgrDesc(), i, printf, and RM_MAX_BUILTIN_ID.
Referenced by main().
|
static |
Definition at line 210 of file pg_waldump.c.
References buf, close, closedir(), dirent::d_name, directory, exit(), fd(), if(), IsValidWalSegSize, IsXLogFileName(), ngettext, open_file_in_directory(), opendir(), pg_fatal, pg_log_error, pg_log_error_detail, pg_strdup(), read, readdir(), WalSegSz, and XLogLongPageHeaderData::xlp_seg_size.
Referenced by identify_target_directory().
|
static |
|
static |
Definition at line 161 of file pg_waldump.c.
References pg_strdup(), and pnstrdup().
Referenced by main().
|
static |
|
static |
Definition at line 113 of file pg_waldump.c.
References closedir(), directory, and opendir().
Referenced by main().
|
static |
Definition at line 380 of file pg_waldump.c.
References close.
Referenced by main().
|
static |
Definition at line 338 of file pg_waldump.c.
References MAXPGPATH, open_file_in_directory(), pg_fatal, pg_usleep(), and XLogFileName().
Referenced by main().
|
static |
Definition at line 389 of file pg_waldump.c.
References InvalidXLogRecPtr, MAXPGPATH, pg_fatal, WALRead(), WALReadError::wre_errno, WALReadError::wre_off, WALReadError::wre_read, WALReadError::wre_req, WALReadError::wre_seg, WALOpenSegment::ws_segno, WALOpenSegment::ws_tli, and XLogFileName().
Referenced by main().
|
static |
Definition at line 546 of file pg_waldump.c.
References XLogDumpConfig::bkp_details, StringInfoData::data, GetRmgrDesc(), initStringInfo(), LSN_FORMAT_ARGS, pfree(), printf, XLogReaderState::ReadRecPtr, resetStringInfo(), RmgrDescData::rm_desc, RmgrDescData::rm_identify, RmgrDescData::rm_name, XLogRecGetBlockRefInfo(), XLogRecGetInfo, XLogRecGetLen(), XLogRecGetPrev, XLogRecGetRmid, XLogRecGetTotalLen, XLogRecGetXid, and XLR_INFO_MASK.
Referenced by main().
|
static |
Definition at line 626 of file pg_waldump.c.
References XLogRecStats::count, XLogStats::count, XLogRecStats::fpi_len, GetRmgrDesc(), LSN_FORMAT_ARGS, MAX_XLINFO_TYPES, printf, psprintf(), XLogRecStats::rec_len, XLogStats::record_stats, RmgrDescData::rm_identify, RM_MAX_ID, RmgrDescData::rm_name, XLogStats::rmgr_stats, RmgrIdIsCustom(), RmgrIdIsValid, XLogDumpConfig::stats_per_record, XLogDumpStatsRow(), and XLogRecPtrIsInvalid.
Referenced by main().
|
static |
|
static |
Definition at line 469 of file pg_waldump.c.
References XLogRecHasBlockImage, XLogRecHasBlockRef, and XLogRecMaxBlockId.
Referenced by main().
|
static |
Definition at line 438 of file pg_waldump.c.
References emptyRelFileLocator, InvalidBlockNumber, InvalidForkNumber, RelFileLocatorEquals, XLogRecGetBlockTagExtended(), and XLogRecMaxBlockId.
Referenced by main().
|
static |
Definition at line 490 of file pg_waldump.c.
References buf, RelFileLocator::dbOid, XLogReaderState::errormsg_buf, filename, FORKNAMECHARS, forkNames, if(), LSN_FORMAT_ARGS, MAX_FORKNUM, MAXPGPATH, PG_BINARY_W, pg_fatal, XLogReaderState::ReadRecPtr, RelFileLocator::relNumber, RestoreBlockImage(), XLogReaderState::seg, snprintf, RelFileLocator::spcOid, sprintf, WALOpenSegment::ws_tli, XLogRecGetBlockTagExtended(), XLogRecHasBlockImage, XLogRecHasBlockRef, and XLogRecMaxBlockId.
Referenced by main().
|
static |
Definition at line 45 of file pg_waldump.c.
Referenced by main(), and XLogRecordMatchesRelationBlock().
|
static |
Definition at line 40 of file pg_waldump.c.
|
static |
Definition at line 43 of file pg_waldump.c.
Referenced by main(), and sigint_handler().
|
static |
Definition at line 42 of file pg_waldump.c.
Referenced by main(), and search_directory().