#include "postgres_fe.h"
#include <dirent.h>
#include <fcntl.h>
#include <limits.h>
#include <sys/stat.h>
#include <time.h>
#include "access/xlog_internal.h"
#include "common/logging.h"
#include "common/parse_manifest.h"
#include "fe_utils/simple_list.h"
#include "getopt_long.h"
#include "pg_verifybackup.h"
#include "pgtime.h"
Go to the source code of this file.
Definition at line 42 of file pg_verifybackup.c.
Definition at line 47 of file pg_verifybackup.c.
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(), verifier_context::format, PG_COMPRESSION_GZIP, PG_COMPRESSION_LZ4, and PG_COMPRESSION_ZSTD.
Referenced by verify_tar_backup().
Definition at line 118 of file pg_verifybackup.c.
References _, arg, canonicalize_path(), 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().
Definition at line 392 of file pg_verifybackup.c.
References close, JsonManifestParseContext::error_cb, 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, JsonManifestParseContext::per_file_cb, JsonManifestParseContext::per_wal_range_cb, pfree(), PG_BINARY, pg_fatal, pg_malloc(), pg_malloc0(), PG_UINT32_MAX, JsonManifestParseContext::private_data, read, READ_CHUNK_SIZE, report_fatal_error(), report_manifest_error(), stat::st_size, JsonManifestParseContext::system_identifier_cb, verifybackup_per_file_cb(), verifybackup_per_wal_range_cb(), verifybackup_system_identifier(), verifybackup_version_cb(), and JsonManifestParseContext::version_cb.
Referenced by main().
Definition at line 1200 of file pg_verifybackup.c.
References manifest_wal_range::end_lsn, LSN_FORMAT_ARGS, manifest, verifier_context::manifest, manifest_wal_range::next, psprintf(), report_backup_error(), manifest_wal_range::start_lsn, and manifest_wal_range::tli.
Referenced by main().
Definition at line 881 of file pg_verifybackup.c.
References Assert(), tar_file::compress_algorithm, verifier_context::format, 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().
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().
Definition at line 1231 of file pg_verifybackup.c.
References verifier_context::exit_on_error, gettext, PG_LOG_ERROR, pg_log_generic_v(), PG_LOG_PRIMARY, and verifier_context::saw_any_error.
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().
Definition at line 1039 of file pg_verifybackup.c.
References manifest, verifier_context::manifest, manifest_file::matched, manifest_file::pathname, report_backup_error(), and should_ignore_relpath().
Referenced by main().
Definition at line 1248 of file pg_verifybackup.c.
References gettext, PG_LOG_ERROR, pg_log_generic_v(), and PG_LOG_PRIMARY.
Referenced by main(), member_verify_control_data(), parse_manifest_file(), verify_control_file(), and verifybackup_per_file_cb().
Definition at line 509 of file pg_verifybackup.c.
References gettext, PG_LOG_ERROR, pg_log_generic_v(), and PG_LOG_PRIMARY.
Referenced by parse_manifest_file().
Definition at line 1267 of file pg_verifybackup.c.
References SimpleStringList::head, verifier_context::ignore_list, 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().
Definition at line 1059 of file pg_verifybackup.c.
References verifier_context::backup_directory, manifest, verifier_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().
Definition at line 755 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().
Definition at line 1099 of file pg_verifybackup.c.
References manifest_file::checksum_length, manifest_file::checksum_payload, manifest_file::checksum_type, close, 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().
Definition at line 616 of file pg_verifybackup.c.
References closedir(), dirent::d_name, filename, verifier_context::ignore_list, 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().
Definition at line 669 of file pg_verifybackup.c.
References manifest_data::files, verifier_context::ignore_list, verifier_context::manifest, relpath, report_backup_error(), S_ISDIR, S_ISREG, should_verify_checksum, show_progress, simple_string_list_append(), verifier_context::skip_checksums, stat::st_mode, stat::st_size, stat, manifest_data::system_identifier, total_size, verify_control_file(), verify_plain_backup_directory(), manifest_data::version, and XLOG_CONTROL_FILE.
Referenced by verify_plain_backup_directory().
Definition at line 790 of file pg_verifybackup.c.
References Assert(), astreamer_finalize(), astreamer_free(), verifier_context::backup_directory, closedir(), tar_file::compress_algorithm, create_archive_verifier(), dirent::d_name, filename, verifier_context::format, 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().
Definition at line 993 of file pg_verifybackup.c.
References astreamer_content(), ASTREAMER_UNKNOWN, close, 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().
Definition at line 550 of file pg_verifybackup.c.
References manifest_file::bad, manifest_file::checksum_length, manifest_file::checksum_payload, manifest_file::checksum_type, manifest, manifest_file::matched, JsonManifestParseContext::private_data, report_fatal_error(), and manifest_file::size.
Referenced by parse_manifest_file().
Definition at line 579 of file pg_verifybackup.c.
References manifest, palloc(), JsonManifestParseContext::private_data, and range().
Referenced by parse_manifest_file().
Definition at line 537 of file pg_verifybackup.c.
References manifest, and JsonManifestParseContext::private_data.
Referenced by parse_manifest_file().
Definition at line 524 of file pg_verifybackup.c.
References manifest, and JsonManifestParseContext::private_data.
Referenced by parse_manifest_file().
Definition at line 112 of file pg_verifybackup.c.
Referenced by progress_report(), verify_file_checksum(), and verify_tar_file().
Definition at line 105 of file pg_verifybackup.c.
Definition at line 108 of file pg_verifybackup.c.
Referenced by main(), precheck_tar_backup_file(), progress_report(), and verify_plain_backup_file().
Definition at line 111 of file pg_verifybackup.c.
Referenced by precheck_tar_backup_file(), progress_report(), and verify_plain_backup_file().