PostgreSQL Source Code
git master
|
#include "postgres_fe.h"
#include <dirent.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <time.h>
#include "common/controldata_utils.h"
#include "common/hashfn_unstable.h"
#include "common/logging.h"
#include "common/parse_manifest.h"
#include "fe_utils/simple_list.h"
#include "getopt_long.h"
#include "pgtime.h"
#include "lib/simplehash.h"
Go to the source code of this file.
Data Structures | |
struct | manifest_file |
struct | manifest_wal_range |
struct | manifest_data |
struct | verifier_context |
Macros | |
#define | ESTIMATED_BYTES_PER_MANIFEST_LINE 100 |
#define | READ_CHUNK_SIZE (128 * 1024) |
#define | should_verify_checksum(m) (((m)->matched) && !((m)->bad) && (((m)->checksum_type) != CHECKSUM_TYPE_NONE)) |
#define | SH_PREFIX manifest_files |
#define | SH_ELEMENT_TYPE manifest_file |
#define | SH_KEY_TYPE char * |
#define | SH_KEY pathname |
#define | SH_HASH_KEY(tb, key) hash_string(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 manifest_file | manifest_file |
typedef struct manifest_wal_range | manifest_wal_range |
typedef struct manifest_data | manifest_data |
typedef struct verifier_context | verifier_context |
Variables | |
static const char * | progname |
static bool | show_progress = false |
static bool | skip_checksums = 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.
#define SH_DECLARE |
Definition at line 79 of file pg_verifybackup.c.
#define SH_DEFINE |
Definition at line 80 of file pg_verifybackup.c.
#define SH_ELEMENT_TYPE manifest_file |
Definition at line 72 of file pg_verifybackup.c.
#define SH_HASH_KEY | ( | tb, | |
key | |||
) | hash_string(key) |
Definition at line 75 of file pg_verifybackup.c.
#define SH_KEY pathname |
Definition at line 74 of file pg_verifybackup.c.
#define SH_KEY_TYPE char * |
Definition at line 73 of file pg_verifybackup.c.
#define SH_PREFIX manifest_files |
Definition at line 71 of file pg_verifybackup.c.
#define SH_RAW_ALLOCATOR pg_malloc0 |
Definition at line 78 of file pg_verifybackup.c.
#define SH_SCOPE static inline |
Definition at line 77 of file pg_verifybackup.c.
#define should_verify_checksum | ( | m | ) | (((m)->matched) && !((m)->bad) && (((m)->checksum_type) != CHECKSUM_TYPE_NONE)) |
Definition at line 64 of file pg_verifybackup.c.
typedef struct manifest_data manifest_data |
typedef struct manifest_file manifest_file |
typedef struct manifest_wal_range manifest_wal_range |
typedef struct verifier_context verifier_context |
int main | ( | int | argc, |
char ** | argv | ||
) |
Definition at line 177 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(), skip_checksums, strlcpy(), usage(), verify_backup_checksums(), and verify_backup_directory().
|
static |
Definition at line 390 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 952 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 1048 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().
|
static |
Definition at line 983 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 791 of file pg_verifybackup.c.
References context, manifest, manifest_file::matched, manifest_file::pathname, report_backup_error(), and should_ignore_relpath().
Referenced by main().
|
static |
Definition at line 1000 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 507 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().
|
static |
Definition at line 1019 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 811 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 610 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 675 of file pg_verifybackup.c.
References context, relpath, report_backup_error(), S_ISDIR, S_ISREG, should_verify_checksum, show_progress, simple_string_list_append(), skip_checksums, 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 758 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 851 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 548 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 577 of file pg_verifybackup.c.
References context, manifest, palloc(), and range().
Referenced by parse_manifest_file().
|
static |
Definition at line 535 of file pg_verifybackup.c.
References context, and manifest.
Referenced by parse_manifest_file().
|
static |
Definition at line 522 of file pg_verifybackup.c.
References context, and manifest.
Referenced by parse_manifest_file().
|
static |
Definition at line 171 of file pg_verifybackup.c.
Referenced by progress_report(), and verify_file_checksum().
|
static |
Definition at line 163 of file pg_verifybackup.c.
Definition at line 166 of file pg_verifybackup.c.
Referenced by main(), progress_report(), and verify_backup_file().
Definition at line 167 of file pg_verifybackup.c.
Referenced by main(), and verify_backup_file().
|
static |
Definition at line 170 of file pg_verifybackup.c.
Referenced by progress_report(), and verify_backup_file().