PostgreSQL Source Code git master
Loading...
Searching...
No Matches
pg_verifybackup.h File Reference
Include dependency graph for pg_verifybackup.h:
This graph shows which files directly or indirectly include this file:

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 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   const 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
 

Functions

void report_backup_error (verifier_context *context, const char *pg_restrict fmt,...) pg_attribute_printf(2
 
void pg_noreturn void report_fatal_error (const char *pg_restrict fmt,...) pg_attribute_printf(1
 
void pg_noreturn void bool should_ignore_relpath (verifier_context *context, const char *relpath)
 
astreamerastreamer_verify_content_new (astreamer *next, verifier_context *context, char *archive_name, Oid tblspc_oid)
 

Macro Definition Documentation

◆ SH_DECLARE

#define SH_DECLARE

Definition at line 55 of file pg_verifybackup.h.

◆ SH_DEFINE

#define SH_DEFINE

Definition at line 56 of file pg_verifybackup.h.

◆ SH_ELEMENT_TYPE

#define SH_ELEMENT_TYPE   manifest_file

Definition at line 48 of file pg_verifybackup.h.

◆ SH_EQUAL

#define SH_EQUAL (   tb,
  a,
  b 
)    (strcmp(a, b) == 0)

Definition at line 52 of file pg_verifybackup.h.

◆ SH_HASH_KEY

#define SH_HASH_KEY (   tb,
  key 
)    hash_string(key)

Definition at line 51 of file pg_verifybackup.h.

◆ SH_KEY

#define SH_KEY   pathname

Definition at line 50 of file pg_verifybackup.h.

◆ SH_KEY_TYPE

#define SH_KEY_TYPE   const char *

Definition at line 49 of file pg_verifybackup.h.

◆ SH_PREFIX

#define SH_PREFIX   manifest_files

Definition at line 47 of file pg_verifybackup.h.

◆ SH_RAW_ALLOCATOR

#define SH_RAW_ALLOCATOR   pg_malloc0

Definition at line 54 of file pg_verifybackup.h.

◆ SH_SCOPE

#define SH_SCOPE   static inline

Definition at line 53 of file pg_verifybackup.h.

◆ should_verify_checksum

#define should_verify_checksum (   m)     (((m)->matched) && !((m)->bad) && (((m)->checksum_type) != CHECKSUM_TYPE_NONE))

Definition at line 40 of file pg_verifybackup.h.

63{
64 TimeLineID tli;
65 XLogRecPtr start_lsn;
66 XLogRecPtr end_lsn;
70
71/*
72 * All the data parsed from a backup_manifest file.
73 */
74typedef struct manifest_data
75{
76 int version;
82
83/*
84 * All of the context information we need while checking a backup manifest.
85 */
86typedef struct verifier_context
87{
89 char *backup_directory;
91 char format; /* backup format: p(lain)/t(ar) */
92 bool skip_checksums;
93 bool exit_on_error;
94 bool saw_any_error;
96
97extern void report_backup_error(verifier_context *context,
98 const char *pg_restrict fmt,...)
103 const char *relpath);
104
106 verifier_context *context,
107 char *archive_name,
108 Oid tblspc_oid);
109
110#endif /* PG_VERIFYBACKUP_H */
static int32 next
Definition blutils.c:225
#define pg_noreturn
Definition c.h:164
#define pg_attribute_printf(f, a)
Definition c.h:242
uint64_t uint64
Definition c.h:547
void pg_noreturn void report_fatal_error(const char *pg_restrict fmt,...) pg_attribute_printf(1
void pg_noreturn void bool should_ignore_relpath(verifier_context *context, const char *relpath)
astreamer * astreamer_verify_content_new(astreamer *next, verifier_context *context, char *archive_name, Oid tblspc_oid)
void report_backup_error(verifier_context *context, const char *pg_restrict fmt,...) pg_attribute_printf(2
unsigned int Oid
static int fb(int x)
#define relpath(rlocator, forknum)
Definition relpath.h:150
manifest_wal_range * last_wal_range
manifest_wal_range * first_wal_range
uint64 system_identifier
manifest_files_hash * files
struct manifest_wal_range * prev
SimpleStringList ignore_list
manifest_data * manifest
uint64 XLogRecPtr
Definition xlogdefs.h:21
uint32 TimeLineID
Definition xlogdefs.h:63

Typedef Documentation

◆ manifest_data

◆ manifest_file

◆ manifest_wal_range

◆ verifier_context

Function Documentation

◆ astreamer_verify_content_new()

astreamer * astreamer_verify_content_new ( astreamer next,
verifier_context context,
char archive_name,
Oid  tblspc_oid 
)
extern

Definition at line 67 of file astreamer_verify.c.

69{
70 astreamer_verify *streamer;
71
73 *((const astreamer_ops **) &streamer->base.bbs_ops) =
75
76 streamer->base.bbs_next = next;
77 streamer->context = context;
78 streamer->archive_name = archive_name;
79 streamer->tblspc_oid = tblspc_oid;
80
81 if (!context->skip_checksums)
82 streamer->checksum_ctx = pg_malloc(sizeof(pg_checksum_context));
83
84 return &streamer->base;
85}
static const astreamer_ops astreamer_verify_ops
void * pg_malloc(size_t size)
Definition fe_memutils.c:47
#define palloc0_object(type)
Definition fe_memutils.h:75
verifier_context * context
pg_checksum_context * checksum_ctx
const astreamer_ops * bbs_ops
Definition astreamer.h:109
astreamer * bbs_next
Definition astreamer.h:110

References astreamer_verify::archive_name, astreamer_verify_ops, astreamer_verify::base, astreamer::bbs_next, astreamer::bbs_ops, astreamer_verify::checksum_ctx, astreamer_verify::context, next, palloc0_object, pg_malloc(), verifier_context::skip_checksums, and astreamer_verify::tblspc_oid.

Referenced by create_archive_verifier().

◆ report_backup_error()

void report_backup_error ( verifier_context context,
const char *pg_restrict  fmt,
  ... 
)
extern

◆ report_fatal_error()

void pg_noreturn void report_fatal_error ( const char *pg_restrict  fmt,
  ... 
)
extern

◆ should_ignore_relpath()

void pg_noreturn void bool should_ignore_relpath ( verifier_context context,
const char relpath 
)
extern

Definition at line 1267 of file pg_verifybackup.c.

1268{
1270
1271 for (cell = context->ignore_list.head; cell != NULL; cell = cell->next)
1272 {
1273 const char *r = relpath;
1274 char *v = cell->val;
1275
1276 while (*v != '\0' && *r == *v)
1277 ++r, ++v;
1278
1279 if (*v == '\0' && (*r == '\0' || *r == '/'))
1280 return true;
1281 }
1282
1283 return false;
1284}
char val[FLEXIBLE_ARRAY_MEMBER]
Definition simple_list.h:37
struct SimpleStringListCell * next
Definition simple_list.h:34
SimpleStringListCell * head
Definition simple_list.h:42

References fb(), 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().