PostgreSQL Source Code
git master
|
#include "postgres.h"
#include <dirent.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 "common/fe_memutils.h"
#include "common/logging.h"
#include "getopt_long.h"
#include "rmgrdesc.h"
Go to the source code of this file.
Data Structures | |
struct | XLogDumpPrivate |
struct | XLogDumpConfig |
struct | Stats |
struct | XLogDumpStats |
Macros | |
#define | FRONTEND 1 |
#define | MAX_XLINFO_TYPES 16 |
#define | fatal_error(...) do { pg_log_fatal(__VA_ARGS__); exit(EXIT_FAILURE); } while(0) |
Typedefs | |
typedef struct XLogDumpPrivate | XLogDumpPrivate |
typedef struct XLogDumpConfig | XLogDumpConfig |
typedef struct Stats | Stats |
typedef struct XLogDumpStats | XLogDumpStats |
Functions | |
static void | print_rmgr_list (void) |
static bool | verify_directory (const char *directory) |
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 int | WALDumpOpenSegment (XLogSegNo nextSegNo, WALSegmentContext *segcxt, TimeLineID *tli_p) |
static int | WALDumpReadPage (XLogReaderState *state, XLogRecPtr targetPagePtr, int reqLen, XLogRecPtr targetPtr, char *readBuff) |
static void | XLogDumpRecordLen (XLogReaderState *record, uint32 *rec_len, uint32 *fpi_len) |
static void | XLogDumpCountRecord (XLogDumpConfig *config, XLogDumpStats *stats, XLogReaderState *record) |
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, XLogDumpStats *stats) |
static void | usage (void) |
int | main (int argc, char **argv) |
Variables | |
static const char * | progname |
static int | WalSegSz |
#define fatal_error | ( | ... | ) | do { pg_log_fatal(__VA_ARGS__); exit(EXIT_FAILURE); } while(0) |
Definition at line 72 of file pg_waldump.c.
Referenced by identify_target_directory(), main(), open_file_in_directory(), search_directory(), WALDumpOpenSegment(), and WALDumpReadPage().
#define FRONTEND 1 |
Definition at line 12 of file pg_waldump.c.
#define MAX_XLINFO_TYPES 16 |
Definition at line 63 of file pg_waldump.c.
Referenced by XLogDumpDisplayStats().
typedef struct XLogDumpConfig XLogDumpConfig |
typedef struct XLogDumpPrivate XLogDumpPrivate |
typedef struct XLogDumpStats XLogDumpStats |
|
static |
Definition at line 238 of file pg_waldump.c.
References datadir, fatal_error, MAXPGPATH, pg_strdup(), search_directory(), snprintf, and XLOGDIR.
Referenced by main().
int main | ( | int | argc, |
char ** | argv | ||
) |
Definition at line 738 of file pg_waldump.c.
References _, XLogDumpConfig::already_displayed_records, XLogDumpConfig::bkp_details, close, directory, XLogDumpPrivate::endptr, EXIT_FAILURE, EXIT_SUCCESS, fatal_error, fd(), XLogDumpConfig::filter_by_rmgr, XLogDumpConfig::filter_by_xid, XLogDumpConfig::filter_by_xid_enabled, XLogDumpConfig::follow, fprintf, get_progname(), getopt_long(), i, identify_target_directory(), InvalidTransactionId, InvalidXLogRecPtr, ngettext, no_argument, open_file_in_directory(), optarg, optind, optional_argument, pg_log_error, pg_logging_init(), pg_strcasecmp(), pg_strdup(), PG_TEXTDOMAIN, pg_usleep(), print_rmgr_list(), printf, progname, XLogReaderState::ReadRecPtr, required_argument, RM_MAX_ID, RmgrDescTable, set_pglocale_pgservice(), split_path(), XLogDumpPrivate::startptr, XLogDumpConfig::stats, XLogDumpConfig::stats_per_record, XLogDumpConfig::stop_after_records, strerror, XLogDumpPrivate::timeline, usage(), verify_directory(), WALDumpReadPage(), WalSegSz, XLogRecord::xl_rmid, XLogRecord::xl_xid, XLByteInSeg, XLogDumpCountRecord(), XLogDumpDisplayRecord(), XLogDumpDisplayStats(), XLogFromFileName, XLogReaderAllocate(), XLogReaderFree(), XLogReadRecord(), XLogRecPtrIsInvalid, XLogSegmentOffset, and XLogSegNoOffsetToRecPtr.
|
static |
Definition at line 134 of file pg_waldump.c.
References Assert, fatal_error, fd(), MAXPGPATH, PG_BINARY, snprintf, and strerror.
Referenced by main(), search_directory(), and WALDumpOpenSegment().
|
static |
Definition at line 75 of file pg_waldump.c.
References i, printf, RM_MAX_ID, and RmgrDescTable.
Referenced by main().
|
static |
Definition at line 157 of file pg_waldump.c.
References buf, close, closedir(), dirent::d_name, PGAlignedXLogBlock::data, fatal_error, fd(), IsValidWalSegSize, IsXLogFileName, ngettext, open_file_in_directory(), opendir(), read, readdir(), strerror, WalSegSz, and XLogLongPageHeaderData::xlp_seg_size.
Referenced by identify_target_directory().
|
static |
Definition at line 107 of file pg_waldump.c.
References pg_strdup(), and pnstrdup().
Referenced by main().
|
static |
|
static |
Definition at line 90 of file pg_waldump.c.
References closedir(), and opendir().
Referenced by main().
|
static |
Definition at line 284 of file pg_waldump.c.
References fatal_error, fd(), MAXPGPATH, open_file_in_directory(), pg_usleep(), strerror, WALSegmentContext::ws_dir, WALSegmentContext::ws_segsize, and XLogFileName.
Referenced by WALDumpReadPage().
|
static |
Definition at line 327 of file pg_waldump.c.
References XLogDumpPrivate::endptr, fatal_error, InvalidXLogRecPtr, MAXPGPATH, XLogReaderState::private_data, XLogReaderState::seg, XLogReaderState::segcxt, WALDumpOpenSegment(), WALRead(), WALReadError::wre_errno, WALReadError::wre_off, WALReadError::wre_read, WALReadError::wre_req, WALReadError::wre_seg, WALOpenSegment::ws_segno, WALSegmentContext::ws_segsize, WALOpenSegment::ws_tli, and XLogFileName.
Referenced by main().
|
static |
Definition at line 404 of file pg_waldump.c.
References Stats::count, XLogDumpStats::count, Stats::fpi_len, Stats::rec_len, XLogDumpStats::record_stats, XLogDumpStats::rmgr_stats, XLogDumpRecordLen(), XLogRecGetInfo, and XLogRecGetRmid.
Referenced by main().
|
static |
Definition at line 442 of file pg_waldump.c.
References DecodedBkpBlock::bimg_info, DecodedBkpBlock::bimg_len, XLogDumpConfig::bkp_details, BKPIMAGE_IS_COMPRESSED, XLogReaderState::blocks, StringInfoData::data, RelFileNode::dbNode, forkNames, DecodedBkpBlock::hole_length, DecodedBkpBlock::hole_offset, initStringInfo(), MAIN_FORKNUM, XLogReaderState::max_block_id, pfree(), printf, XLogReaderState::ReadRecPtr, RelFileNode::relNode, RmgrDescData::rm_desc, RmgrDescData::rm_identify, RmgrDescData::rm_name, RmgrDescTable, RelFileNode::spcNode, XLogDumpRecordLen(), XLogRecBlockImageApply, XLogRecGetBlockTag(), XLogRecGetInfo, XLogRecGetPrev, XLogRecGetRmid, XLogRecGetTotalLen, XLogRecGetXid, XLogRecHasBlockImage, XLogRecHasBlockRef, and XLR_INFO_MASK.
Referenced by main().
|
static |
Definition at line 595 of file pg_waldump.c.
References Stats::count, XLogDumpStats::count, Stats::fpi_len, MAX_XLINFO_TYPES, printf, psprintf(), Stats::rec_len, XLogDumpStats::record_stats, RmgrDescData::rm_identify, RmgrDescData::rm_name, RM_NEXT_ID, XLogDumpStats::rmgr_stats, RmgrDescTable, XLogDumpConfig::stats_per_record, and XLogDumpStatsRow().
Referenced by main().
|
static |
Definition at line 375 of file pg_waldump.c.
References DecodedBkpBlock::bimg_len, XLogReaderState::blocks, XLogReaderState::max_block_id, XLogRecGetTotalLen, and XLogRecHasBlockImage.
Referenced by XLogDumpCountRecord(), and XLogDumpDisplayRecord().
|
static |
Definition at line 554 of file pg_waldump.c.
References printf.
Referenced by XLogDumpDisplayStats().
|
static |
Definition at line 28 of file pg_waldump.c.
|
static |
Definition at line 30 of file pg_waldump.c.
Referenced by main(), and search_directory().