|
PostgreSQL Source Code git master
|
#include "postgres_fe.h"#include <unistd.h>#include "access/xlog_internal.h"#include "common/file_perm.h"#include "common/hashfn.h"#include "common/logging.h"#include "fe_utils/simple_list.h"#include "pg_waldump.h"#include "lib/simplehash.h"
Go to the source code of this file.
Data Structures | |
| struct | ArchivedWALFile |
| struct | astreamer_waldump |
Macros | |
| #define | READ_CHUNK_SIZE (128 * 1024) |
| #define | READ_ANY_WAL(privateInfo) ((privateInfo)->start_segno == 0) |
| #define | SH_PREFIX ArchivedWAL |
| #define | SH_ELEMENT_TYPE ArchivedWALFile |
| #define | SH_KEY_TYPE const char * |
| #define | SH_KEY fname |
| #define | SH_HASH_KEY(tb, key) hash_string_pointer(key) |
| #define | SH_EQUAL(tb, a, b) (strcmp(a, b) == 0) |
| #define | SH_SCOPE static inline |
| #define | SH_RAW_ALLOCATOR pg_malloc0 |
| #define | SH_DECLARE |
| #define | SH_DEFINE |
Typedefs | |
| typedef struct ArchivedWALFile | ArchivedWALFile |
| typedef struct astreamer_waldump | astreamer_waldump |
Variables | |
| char * | TmpWalSegDir = NULL |
| static const astreamer_ops | astreamer_waldump_ops |
| #define READ_ANY_WAL | ( | privateInfo | ) | ((privateInfo)->start_segno == 0) |
Definition at line 38 of file archive_waldump.c.
| #define READ_CHUNK_SIZE (128 * 1024) |
Definition at line 29 of file archive_waldump.c.
| #define SH_DECLARE |
Definition at line 80 of file archive_waldump.c.
| #define SH_DEFINE |
Definition at line 81 of file archive_waldump.c.
| #define SH_ELEMENT_TYPE ArchivedWALFile |
Definition at line 73 of file archive_waldump.c.
| #define SH_HASH_KEY | ( | tb, | |
| key | |||
| ) | hash_string_pointer(key) |
Definition at line 76 of file archive_waldump.c.
| #define SH_KEY fname |
Definition at line 75 of file archive_waldump.c.
Definition at line 74 of file archive_waldump.c.
| #define SH_PREFIX ArchivedWAL |
Definition at line 72 of file archive_waldump.c.
| #define SH_RAW_ALLOCATOR pg_malloc0 |
Definition at line 79 of file archive_waldump.c.
Definition at line 78 of file archive_waldump.c.
|
static |
Definition at line 693 of file archive_waldump.c.
References appendBinaryStringInfo(), XLogDumpPrivate::archive_name, XLogDumpPrivate::archive_wal_htab, Assert, ASTREAMER_ARCHIVE_TRAILER, ASTREAMER_MEMBER_CONTENTS, ASTREAMER_MEMBER_HEADER, ASTREAMER_MEMBER_TRAILER, ASTREAMER_UNKNOWN, ArchivedWALFile::buf, XLogDumpPrivate::cur_file, data, XLogDumpPrivate::end_segno, fb(), len, makeStringInfo(), member_is_wal_file(), astreamer_member::pathname, pfree(), pg_fatal, pg_log_debug, pg_log_warning, READ_ANY_WAL, ArchivedWALFile::read_len, XLogDumpPrivate::segsize, ArchivedWALFile::spilled, XLogDumpPrivate::start_segno, XLogDumpPrivate::timeline, and XLogFromFileName().
Definition at line 792 of file archive_waldump.c.
References Assert, astreamer::bbs_next, and fb().
Definition at line 801 of file archive_waldump.c.
References Assert, astreamer::bbs_next, fb(), and pfree().
|
static |
Definition at line 673 of file archive_waldump.c.
References astreamer_waldump_ops, astreamer_waldump::base, astreamer::bbs_ops, palloc0_object, and astreamer_waldump::privateInfo.
Referenced by init_archive_reader().
Definition at line 601 of file archive_waldump.c.
References Assert, fb(), rmtree(), and TmpWalSegDir.
Referenced by prepare_tmp_write().
| void free_archive_reader | ( | XLogDumpPrivate * | privateInfo | ) |
Definition at line 234 of file archive_waldump.c.
References XLogDumpPrivate::archive_fd, XLogDumpPrivate::archive_name, XLogDumpPrivate::archive_read_buf, XLogDumpPrivate::archive_streamer, XLogDumpPrivate::archive_wal_htab, astreamer_free(), ArchivedWALFile::buf, close, destroyStringInfo(), fb(), pg_free(), and pg_log_error.
Referenced by main().
| void free_archive_wal_entry | ( | const char * | fname, |
| XLogDumpPrivate * | privateInfo | ||
| ) |
Definition at line 415 of file archive_waldump.c.
References XLogDumpPrivate::archive_wal_htab, ArchivedWALFile::buf, XLogDumpPrivate::cur_file, destroyStringInfo(), fb(), MAXPGPATH, pg_log_debug, snprintf, ArchivedWALFile::spilled, and TmpWalSegDir.
Referenced by init_archive_reader(), and TarWALDumpReadPage().
|
static |
Definition at line 454 of file archive_waldump.c.
References XLogDumpPrivate::archive_name, XLogDumpPrivate::archive_wal_htab, Assert, ArchivedWALFile::buf, XLogDumpPrivate::cur_file, fb(), ArchivedWALFile::fname, StringInfoData::len, perform_tmp_write(), pg_fatal, prepare_tmp_write(), read_archive_file(), READ_CHUNK_SIZE, resetStringInfo(), and ArchivedWALFile::spilled.
Referenced by read_archive_wal_page().
Definition at line 855 of file archive_waldump.c.
References fb(), and hash_bytes().
| void init_archive_reader | ( | XLogDumpPrivate * | privateInfo, |
| pg_compress_algorithm | compression | ||
| ) |
Definition at line 124 of file archive_waldump.c.
References XLogDumpPrivate::archive_dir, XLogDumpPrivate::archive_fd, XLogDumpPrivate::archive_name, XLogDumpPrivate::archive_read_buf, XLogDumpPrivate::archive_streamer, XLogDumpPrivate::archive_wal_htab, Assert, astreamer_gzip_decompressor_new(), astreamer_lz4_decompressor_new(), astreamer_tar_parser_new(), astreamer_waldump_new(), astreamer_zstd_decompressor_new(), ArchivedWALFile::buf, XLogDumpPrivate::cur_file, StringInfoData::data, XLogDumpPrivate::end_segno, XLogDumpPrivate::endptr, fb(), fd(), ArchivedWALFile::fname, free_archive_wal_entry(), IsValidWalSegSize, StringInfoData::len, ngettext, open_file_in_directory(), PG_COMPRESSION_GZIP, PG_COMPRESSION_LZ4, PG_COMPRESSION_ZSTD, pg_fatal, pg_log_error, pg_log_error_detail, pg_malloc(), read_archive_file(), READ_CHUNK_SIZE, XLogDumpPrivate::segsize, XLogDumpPrivate::start_segno, XLogDumpPrivate::startptr, XLogDumpPrivate::timeline, XLByteToSeg, XLogFromFileName(), and XLogRecPtrIsInvalid.
Referenced by main().
|
static |
Definition at line 812 of file archive_waldump.c.
References canonicalize_path(), fb(), filename, astreamer_member::is_directory, astreamer_member::is_link, IsXLogFileName(), MAXPGPATH, astreamer_member::pathname, pnstrdup(), snprintf, XLOG_FNAME_LEN, and XLOGDIR.
Referenced by astreamer_waldump_content().
Definition at line 653 of file archive_waldump.c.
References Assert, buf, fb(), pg_fatal, and TmpWalSegDir.
Referenced by get_archive_wal_entry().
|
static |
Definition at line 616 of file archive_waldump.c.
References XLogDumpPrivate::archive_dir, cleanup_tmpwal_dir_atexit(), fb(), MAXPGPATH, PG_BINARY_W, pg_fatal, pg_file_create_mode, pg_log_debug, setup_tmpwal_dir(), snprintf, TmpWalSegDir, and unlikely.
Referenced by get_archive_wal_entry().
|
static |
Definition at line 545 of file archive_waldump.c.
References XLogDumpPrivate::archive_fd, XLogDumpPrivate::archive_name, XLogDumpPrivate::archive_read_buf, XLogDumpPrivate::archive_streamer, Assert, astreamer_content(), ASTREAMER_UNKNOWN, fb(), pg_fatal, and read.
Referenced by get_archive_wal_entry(), init_archive_reader(), and read_archive_wal_page().
| int read_archive_wal_page | ( | XLogDumpPrivate * | privateInfo, |
| XLogRecPtr | targetPagePtr, | ||
| Size | count, | ||
| char * | readBuff | ||
| ) |
Definition at line 281 of file archive_waldump.c.
References appendBinaryStringInfo(), XLogDumpPrivate::archive_name, Assert, buf, ArchivedWALFile::buf, XLogDumpPrivate::cur_file, StringInfoData::data, XLogDumpPrivate::decoding_started, fb(), get_archive_wal_entry(), StringInfoData::len, MAXFNAMELEN, Min, pg_fatal, read_archive_file(), READ_CHUNK_SIZE, ArchivedWALFile::read_len, resetStringInfo(), XLogDumpPrivate::segsize, XLogDumpPrivate::timeline, XLByteToSeg, XLogFileName(), and XLogSegNoOffsetToRecPtr.
Referenced by TarWALDumpReadPage().
Definition at line 573 of file archive_waldump.c.
References Assert, canonicalize_path(), fb(), mkdtemp(), pg_fatal, pg_log_debug, psprintf(), and TmpWalSegDir.
Referenced by prepare_tmp_write().
|
static |
Definition at line 111 of file archive_waldump.c.
Referenced by astreamer_waldump_new().
Definition at line 32 of file archive_waldump.c.
Referenced by cleanup_tmpwal_dir_atexit(), free_archive_wal_entry(), perform_tmp_write(), prepare_tmp_write(), setup_tmpwal_dir(), and TarWALDumpReadPage().