PostgreSQL Source Code
git master
|
#include "postgres_fe.h"
#include <dirent.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <time.h>
#include "common/logging.h"
#include "common/parse_manifest.h"
#include "fe_utils/simple_list.h"
#include "getopt_long.h"
#include "limits.h"
#include "pg_verifybackup.h"
#include "pgtime.h"
Go to the source code of this file.
Data Structures | |
struct | tar_file |
Macros | |
#define | ESTIMATED_BYTES_PER_MANIFEST_LINE 100 |
#define | READ_CHUNK_SIZE (128 * 1024) |
Typedefs | |
typedef struct tar_file | tar_file |
Variables | |
static const char * | progname |
static bool | show_progress = false |
static uint64 | total_size = 0 |
static uint64 | done_size = 0 |
#define ESTIMATED_BYTES_PER_MANIFEST_LINE 100 |
Definition at line 41 of file pg_verifybackup.c.
#define READ_CHUNK_SIZE (128 * 1024) |
Definition at line 46 of file pg_verifybackup.c.
|
static |
Definition at line 1291 of file pg_verifybackup.c.
References Assert, astreamer_gzip_decompressor_new(), astreamer_lz4_decompressor_new(), astreamer_tar_parser_new(), astreamer_verify_content_new(), astreamer_zstd_decompressor_new(), context, PG_COMPRESSION_GZIP, PG_COMPRESSION_LZ4, and PG_COMPRESSION_ZSTD.
Referenced by verify_tar_backup().
int main | ( | int | argc, |
char ** | argv | ||
) |
Definition at line 117 of file pg_verifybackup.c.
References _, arg, canonicalize_path(), context, exit(), find_my_exec(), find_other_exec(), get_progname(), getopt_long(), MAXPGPATH, no_argument, opendir(), optarg, optind, parse_manifest_file(), parse_required_wal(), pfree(), pg_fatal, pg_log_error, pg_log_error_hint, pg_logging_init(), pg_malloc(), PG_TEXTDOMAIN, printf, progname, psprintf(), pstrdup(), report_extra_backup_files(), report_fatal_error(), required_argument, set_pglocale_pgservice(), show_progress, simple_string_list_append(), stat, strlcpy(), usage(), verify_backup_checksums(), verify_plain_backup_directory(), and verify_tar_backup().
|
static |
Definition at line 391 of file pg_verifybackup.c.
References close, context, ESTIMATED_BYTES_PER_MANIFEST_LINE, fd(), manifest_data::files, fstat, json_parse_manifest(), json_parse_manifest_incremental_chunk(), json_parse_manifest_incremental_init(), json_parse_manifest_incremental_shutdown(), Max, Min, pfree(), PG_BINARY, pg_fatal, pg_malloc(), pg_malloc0(), PG_UINT32_MAX, read, READ_CHUNK_SIZE, report_fatal_error(), report_manifest_error(), stat::st_size, verifybackup_per_file_cb(), verifybackup_per_wal_range_cb(), verifybackup_system_identifier(), and verifybackup_version_cb().
Referenced by main().
|
static |
Definition at line 1200 of file pg_verifybackup.c.
References context, manifest_wal_range::end_lsn, fflush(), LSN_FORMAT_ARGS, manifest, manifest_wal_range::next, psprintf(), report_backup_error(), manifest_wal_range::start_lsn, and manifest_wal_range::tli.
Referenced by main().
static void pg_attribute_noreturn | ( | ) |
|
static |
Definition at line 880 of file pg_verifybackup.c.
References Assert, tar_file::compress_algorithm, context, InvalidOid, OID_MAX, PG_COMPRESSION_GZIP, PG_COMPRESSION_LZ4, PG_COMPRESSION_NONE, PG_COMPRESSION_ZSTD, pg_malloc(), pstrdup(), tar_file::relpath, relpath, report_backup_error(), S_ISREG, show_progress, simple_ptr_list_append(), stat::st_mode, stat::st_size, stat, tar_file::tblspc_oid, and total_size.
Referenced by verify_tar_backup().
|
static |
Definition at line 1327 of file pg_verifybackup.c.
References _, done_size, fprintf, last_progress_report, now(), show_progress, snprintf, total_size, and UINT64_FORMAT.
Referenced by verify_backup_checksums(), verify_file_checksum(), verify_tar_backup(), and verify_tar_file().
void report_backup_error | ( | verifier_context * | context, |
const char *pg_restrict | fmt, | ||
... | |||
) |
Definition at line 1231 of file pg_verifybackup.c.
References context, exit(), fmt, gettext, PG_LOG_ERROR, pg_log_generic_v(), PG_LOG_PRIMARY, va_end(), and va_start().
Referenced by member_compute_checksum(), member_verify_checksum(), member_verify_header(), parse_required_wal(), precheck_tar_backup_file(), report_extra_backup_files(), verify_file_checksum(), verify_plain_backup_directory(), verify_plain_backup_file(), verify_tar_backup(), and verify_tar_file().
|
static |
Definition at line 1038 of file pg_verifybackup.c.
References context, manifest, manifest_file::matched, manifest_file::pathname, report_backup_error(), and should_ignore_relpath().
Referenced by main().
void report_fatal_error | ( | const char *pg_restrict | fmt, |
... | |||
) |
Definition at line 1248 of file pg_verifybackup.c.
References exit(), fmt, gettext, PG_LOG_ERROR, pg_log_generic_v(), PG_LOG_PRIMARY, va_end(), and va_start().
Referenced by main(), member_verify_control_data(), parse_manifest_file(), verify_control_file(), and verifybackup_per_file_cb().
|
static |
Definition at line 508 of file pg_verifybackup.c.
References exit(), fmt, gettext, PG_LOG_ERROR, pg_log_generic_v(), PG_LOG_PRIMARY, va_end(), and va_start().
Referenced by parse_manifest_file().
bool should_ignore_relpath | ( | verifier_context * | context, |
const char * | relpath | ||
) |
Definition at line 1267 of file pg_verifybackup.c.
References context, SimpleStringListCell::next, relpath, and SimpleStringListCell::val.
Referenced by member_verify_header(), report_extra_backup_files(), verify_backup_checksums(), verify_plain_backup_directory(), and verify_tar_backup().
|
static |
|
static |
Definition at line 1058 of file pg_verifybackup.c.
References context, manifest, manifest_file::pathname, pfree(), pg_malloc(), progress_report(), psprintf(), READ_CHUNK_SIZE, should_ignore_relpath(), should_verify_checksum, and verify_file_checksum().
Referenced by main().
|
static |
Definition at line 754 of file pg_verifybackup.c.
References get_controlfile_by_exact_path(), pfree(), PG_CONTROL_VERSION, ControlFileData::pg_control_version, pg_log_debug, report_fatal_error(), and ControlFileData::system_identifier.
Referenced by verify_plain_backup_file().
|
static |
Definition at line 1098 of file pg_verifybackup.c.
References manifest_file::checksum_length, manifest_file::checksum_payload, manifest_file::checksum_type, close, context, done_size, fd(), manifest_file::pathname, PG_BINARY, pg_checksum_final(), pg_checksum_init(), PG_CHECKSUM_MAX_LENGTH, pg_checksum_update(), progress_report(), read, READ_CHUNK_SIZE, relpath, report_backup_error(), and manifest_file::size.
Referenced by verify_backup_checksums().
|
static |
Definition at line 615 of file pg_verifybackup.c.
References closedir(), context, dirent::d_name, filename, opendir(), pfree(), psprintf(), pstrdup(), readdir(), relpath, report_backup_error(), should_ignore_relpath(), simple_string_list_append(), and verify_plain_backup_file().
Referenced by main(), and verify_plain_backup_file().
|
static |
Definition at line 668 of file pg_verifybackup.c.
References context, relpath, report_backup_error(), S_ISDIR, S_ISREG, should_verify_checksum, show_progress, simple_string_list_append(), stat::st_mode, stat::st_size, stat, total_size, verify_control_file(), and verify_plain_backup_directory().
Referenced by verify_plain_backup_directory().
|
static |
Definition at line 789 of file pg_verifybackup.c.
References Assert, astreamer_finalize(), astreamer_free(), closedir(), tar_file::compress_algorithm, context, create_archive_verifier(), dirent::d_name, filename, SimplePtrList::head, SimplePtrListCell::next, pfree(), precheck_tar_backup_file(), progress_report(), psprintf(), SimplePtrListCell::ptr, readdir(), tar_file::relpath, report_backup_error(), should_ignore_relpath(), simple_ptr_list_destroy(), tar_file::tblspc_oid, and verify_tar_file().
Referenced by main().
|
static |
Definition at line 992 of file pg_verifybackup.c.
References astreamer_content(), ASTREAMER_UNKNOWN, close, context, done_size, fd(), PG_BINARY, pg_free(), pg_log_debug, pg_malloc(), progress_report(), read, READ_CHUNK_SIZE, relpath, and report_backup_error().
Referenced by verify_tar_backup().
|
static |
Definition at line 549 of file pg_verifybackup.c.
References manifest_file::bad, manifest_file::checksum_length, manifest_file::checksum_payload, manifest_file::checksum_type, context, manifest, manifest_file::matched, report_fatal_error(), size, and manifest_file::size.
Referenced by parse_manifest_file().
|
static |
Definition at line 578 of file pg_verifybackup.c.
References context, manifest, palloc(), and range().
Referenced by parse_manifest_file().
|
static |
Definition at line 536 of file pg_verifybackup.c.
References context, and manifest.
Referenced by parse_manifest_file().
|
static |
Definition at line 523 of file pg_verifybackup.c.
References context, and manifest.
Referenced by parse_manifest_file().
|
static |
Definition at line 111 of file pg_verifybackup.c.
Referenced by progress_report(), verify_file_checksum(), and verify_tar_file().
|
static |
Definition at line 104 of file pg_verifybackup.c.
|
static |
Definition at line 107 of file pg_verifybackup.c.
Referenced by main(), precheck_tar_backup_file(), progress_report(), and verify_plain_backup_file().
|
static |
Definition at line 110 of file pg_verifybackup.c.
Referenced by precheck_tar_backup_file(), progress_report(), and verify_plain_backup_file().