PostgreSQL Source Code
git master
Loading...
Searching...
No Matches
pg_verifybackup.h
Go to the documentation of this file.
1
/*-------------------------------------------------------------------------
2
*
3
* pg_verifybackup.h
4
* Verify a backup against a backup manifest.
5
*
6
* Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
7
* Portions Copyright (c) 1994, Regents of the University of California
8
*
9
* src/bin/pg_verifybackup/pg_verifybackup.h
10
*
11
*-------------------------------------------------------------------------
12
*/
13
14
#ifndef PG_VERIFYBACKUP_H
15
#define PG_VERIFYBACKUP_H
16
17
#include "
common/controldata_utils.h
"
18
#include "
common/hashfn_unstable.h
"
19
#include "
common/logging.h
"
20
#include "
common/parse_manifest.h
"
21
#include "
fe_utils/astreamer.h
"
22
#include "
fe_utils/simple_list.h
"
23
24
/*
25
* Each file described by the manifest file is parsed to produce an object
26
* like this.
27
*/
28
typedef
struct
manifest_file
29
{
30
uint32
status
;
/* hash status */
31
const
char
*
pathname
;
32
uint64
size
;
33
pg_checksum_type
checksum_type
;
34
int
checksum_length
;
35
uint8
*
checksum_payload
;
36
bool
matched
;
37
bool
bad
;
38
}
manifest_file
;
39
40
#define should_verify_checksum(m) \
41
(((m)->matched) && !((m)->bad) && (((m)->checksum_type) != CHECKSUM_TYPE_NONE))
42
43
/*
44
* Define a hash table which we can use to store information about the files
45
* mentioned in the backup manifest.
46
*/
47
#define SH_PREFIX manifest_files
48
#define SH_ELEMENT_TYPE manifest_file
49
#define SH_KEY_TYPE const char *
50
#define SH_KEY pathname
51
#define SH_HASH_KEY(tb, key) hash_string(key)
52
#define SH_EQUAL(tb, a, b) (strcmp(a, b) == 0)
53
#define SH_SCOPE static inline
54
#define SH_RAW_ALLOCATOR pg_malloc0
55
#define SH_DECLARE
56
#define SH_DEFINE
57
#include "
lib/simplehash.h
"
58
59
/*
60
* Each WAL range described by the manifest file is parsed to produce an
61
* object like this.
62
*/
63
typedef
struct
manifest_wal_range
64
{
65
TimeLineID
tli
;
66
XLogRecPtr
start_lsn
;
67
XLogRecPtr
end_lsn
;
68
struct
manifest_wal_range
*
next
;
69
struct
manifest_wal_range
*
prev
;
70
}
manifest_wal_range
;
71
72
/*
73
* All the data parsed from a backup_manifest file.
74
*/
75
typedef
struct
manifest_data
76
{
77
int
version
;
78
uint64
system_identifier
;
79
manifest_files_hash
*
files
;
80
manifest_wal_range
*
first_wal_range
;
81
manifest_wal_range
*
last_wal_range
;
82
}
manifest_data
;
83
84
/*
85
* All of the context information we need while checking a backup manifest.
86
*/
87
typedef
struct
verifier_context
88
{
89
manifest_data
*
manifest
;
90
char
*
backup_directory
;
91
SimpleStringList
ignore_list
;
92
char
format
;
/* backup format: p(lain)/t(ar) */
93
bool
skip_checksums
;
94
bool
exit_on_error
;
95
bool
saw_any_error
;
96
}
verifier_context
;
97
98
extern
void
report_backup_error
(
verifier_context
*context,
99
const
char
*
pg_restrict
fmt
,...)
100
pg_attribute_printf
(2, 3);
101
pg_noreturn
extern
void
report_fatal_error
(
const
char
*
pg_restrict
fmt
,...)
102
pg_attribute_printf
(1, 2);
103
extern
bool
should_ignore_relpath
(
verifier_context
*context,
104
const
char
*
relpath
);
105
106
extern
astreamer
*
astreamer_verify_content_new
(
astreamer
*
next
,
107
verifier_context
*context,
108
char
*archive_name,
109
Oid
tblspc_oid);
110
111
#endif
/* PG_VERIFYBACKUP_H */
astreamer.h
next
static int32 next
Definition
blutils.c:225
uint8
uint8_t uint8
Definition
c.h:544
pg_noreturn
#define pg_noreturn
Definition
c.h:164
pg_attribute_printf
#define pg_attribute_printf(f, a)
Definition
c.h:242
uint64
uint64_t uint64
Definition
c.h:547
uint32
uint32_t uint32
Definition
c.h:546
pg_checksum_type
pg_checksum_type
Definition
checksum_helper.h:30
controldata_utils.h
hashfn_unstable.h
logging.h
parse_manifest.h
report_fatal_error
void pg_noreturn void report_fatal_error(const char *pg_restrict fmt,...) pg_attribute_printf(1
should_ignore_relpath
void pg_noreturn void bool should_ignore_relpath(verifier_context *context, const char *relpath)
Definition
pg_verifybackup.c:1267
astreamer_verify_content_new
astreamer * astreamer_verify_content_new(astreamer *next, verifier_context *context, char *archive_name, Oid tblspc_oid)
Definition
astreamer_verify.c:67
report_backup_error
void report_backup_error(verifier_context *context, const char *pg_restrict fmt,...) pg_attribute_printf(2
Oid
unsigned int Oid
Definition
postgres_ext.h:32
fb
static int fb(int x)
Definition
preproc-init.c:92
relpath
#define relpath(rlocator, forknum)
Definition
relpath.h:150
simple_list.h
simplehash.h
SimpleStringList
Definition
simple_list.h:41
astreamer
Definition
astreamer.h:108
manifest_data
Definition
load_manifest.h:57
manifest_data::last_wal_range
manifest_wal_range * last_wal_range
Definition
load_manifest.h:61
manifest_data::first_wal_range
manifest_wal_range * first_wal_range
Definition
load_manifest.h:60
manifest_data::system_identifier
uint64 system_identifier
Definition
load_manifest.h:58
manifest_data::version
int version
Definition
pg_verifybackup.h:77
manifest_data::files
manifest_files_hash * files
Definition
load_manifest.h:59
manifest_file
Definition
load_manifest.h:23
manifest_file::checksum_length
int checksum_length
Definition
load_manifest.h:28
manifest_file::status
uint32 status
Definition
load_manifest.h:24
manifest_file::checksum_payload
uint8 * checksum_payload
Definition
load_manifest.h:29
manifest_file::checksum_type
pg_checksum_type checksum_type
Definition
load_manifest.h:27
manifest_file::size
uint64 size
Definition
load_manifest.h:26
manifest_file::pathname
const char * pathname
Definition
load_manifest.h:25
manifest_file::matched
bool matched
Definition
pg_verifybackup.h:36
manifest_file::bad
bool bad
Definition
pg_verifybackup.h:37
manifest_wal_range
Definition
load_manifest.h:45
manifest_wal_range::end_lsn
XLogRecPtr end_lsn
Definition
load_manifest.h:48
manifest_wal_range::next
struct manifest_wal_range * next
Definition
load_manifest.h:49
manifest_wal_range::prev
struct manifest_wal_range * prev
Definition
load_manifest.h:50
manifest_wal_range::tli
TimeLineID tli
Definition
load_manifest.h:46
manifest_wal_range::start_lsn
XLogRecPtr start_lsn
Definition
load_manifest.h:47
verifier_context
Definition
pg_verifybackup.h:88
verifier_context::skip_checksums
bool skip_checksums
Definition
pg_verifybackup.h:93
verifier_context::ignore_list
SimpleStringList ignore_list
Definition
pg_verifybackup.h:91
verifier_context::saw_any_error
bool saw_any_error
Definition
pg_verifybackup.h:95
verifier_context::format
char format
Definition
pg_verifybackup.h:92
verifier_context::manifest
manifest_data * manifest
Definition
pg_verifybackup.h:89
verifier_context::backup_directory
char * backup_directory
Definition
pg_verifybackup.h:90
verifier_context::exit_on_error
bool exit_on_error
Definition
pg_verifybackup.h:94
XLogRecPtr
uint64 XLogRecPtr
Definition
xlogdefs.h:21
TimeLineID
uint32 TimeLineID
Definition
xlogdefs.h:63
src
bin
pg_verifybackup
pg_verifybackup.h
Generated on Fri Jan 30 2026 06:13:16 for PostgreSQL Source Code by
1.9.8