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 "pg_verifybackup.h"
#include "pgtime.h"
Go to the source code of this file.
Macros | |
#define | ESTIMATED_BYTES_PER_MANIFEST_LINE 100 |
#define | READ_CHUNK_SIZE (128 * 1024) |
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 40 of file pg_verifybackup.c.
#define READ_CHUNK_SIZE (128 * 1024) |
Definition at line 45 of file pg_verifybackup.c.
int main | ( | int | argc, |
char ** | argv | ||
) |
Definition at line 96 of file pg_verifybackup.c.
References _, arg, canonicalize_path(), context, exit(), find_my_exec(), find_other_exec(), get_progname(), getopt_long(), MAXPGPATH, no_argument, optarg, optind, parse_manifest_file(), parse_required_wal(), pg_fatal, pg_log_error, pg_log_error_hint, pg_logging_init(), pg_malloc(), PG_TEXTDOMAIN, printf, progname, psprintf(), pstrdup(), report_extra_backup_files(), required_argument, set_pglocale_pgservice(), show_progress, simple_string_list_append(), strlcpy(), usage(), verify_backup_checksums(), and verify_backup_directory().
|
static |
Definition at line 309 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 872 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 968 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(), and verify_file_checksum().
void report_backup_error | ( | verifier_context * | context, |
const char *pg_restrict | fmt, | ||
... | |||
) |
Definition at line 903 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 parse_required_wal(), report_extra_backup_files(), verify_backup_directory(), verify_backup_file(), and verify_file_checksum().
|
static |
Definition at line 711 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 920 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(), verify_backup_directory(), verify_control_file(), and verifybackup_per_file_cb().
|
static |
Definition at line 426 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 939 of file pg_verifybackup.c.
References context, SimpleStringListCell::next, relpath, and SimpleStringListCell::val.
Referenced by report_extra_backup_files(), verify_backup_checksums(), and verify_backup_directory().
|
static |
|
static |
Definition at line 731 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 529 of file pg_verifybackup.c.
References closedir(), context, dirent::d_name, filename, opendir(), pfree(), psprintf(), pstrdup(), readdir(), relpath, report_backup_error(), report_fatal_error(), should_ignore_relpath(), simple_string_list_append(), and verify_backup_file().
Referenced by main(), and verify_backup_file().
|
static |
Definition at line 594 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_backup_directory(), and verify_control_file().
Referenced by verify_backup_directory().
|
static |
Definition at line 678 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_backup_file().
|
static |
Definition at line 771 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 467 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 496 of file pg_verifybackup.c.
References context, manifest, palloc(), and range().
Referenced by parse_manifest_file().
|
static |
Definition at line 454 of file pg_verifybackup.c.
References context, and manifest.
Referenced by parse_manifest_file().
|
static |
Definition at line 441 of file pg_verifybackup.c.
References context, and manifest.
Referenced by parse_manifest_file().
|
static |
Definition at line 90 of file pg_verifybackup.c.
Referenced by progress_report(), and verify_file_checksum().
|
static |
Definition at line 83 of file pg_verifybackup.c.
Definition at line 86 of file pg_verifybackup.c.
Referenced by main(), progress_report(), and verify_backup_file().
|
static |
Definition at line 89 of file pg_verifybackup.c.
Referenced by progress_report(), and verify_backup_file().