42#define AppendToManifest(manifest, ...) \
44 char *_manifest_s = psprintf(__VA_ARGS__); \
45 AppendStringToManifest(manifest, _manifest_s); \
62 manifest->checksum_type = manifest_checksum_type;
71 elog(
ERROR,
"failed to initialize checksum of backup manifest: %s",
82 "{ \"PostgreSQL-Backup-Manifest-Version\": 2,\n"
186 elog(
ERROR,
"could not finalize checksum of file \"%s\"",
190 ", \"Checksum-Algorithm\": \"%s\", \"Checksum\": \"",
219 bool first_wal_range =
true;
253 if (first_wal_range &&
endtli != entry->
tli)
255 errmsg(
"expected end timeline %u but found timeline %u",
265 if (starttli == entry->
tli)
279 errmsg(
"expected start timeline %u but found timeline %u",
280 starttli, entry->
tli));
284 "%s{ \"Timeline\": %u, \"Start-LSN\": \"%X/%08X\", \"End-LSN\": \"%X/%08X\" }",
285 first_wal_range ?
"" :
",\n",
290 if (starttli == entry->
tli)
296 endptr = entry->
begin;
297 first_wal_range =
false;
306 errmsg(
"start timeline %u not found in history of timeline %u",
337 manifest->still_checksumming =
false;
340 elog(
ERROR,
"failed to finalize checksum of backup manifest: %s",
357 errmsg(
"could not rewind temporary file")));
392 elog(
ERROR,
"failed to update checksum of backup manifest: %s",
List * readTimeLineHistory(TimeLineID targetTLI)
void InitializeBackupManifest(backup_manifest_info *manifest, backup_manifest_option want_manifest, pg_checksum_type manifest_checksum_type)
void AddFileToBackupManifest(backup_manifest_info *manifest, Oid spcoid, const char *pathname, size_t size, pg_time_t mtime, pg_checksum_context *checksum_ctx)
void AddWALInfoToBackupManifest(backup_manifest_info *manifest, XLogRecPtr startptr, TimeLineID starttli, XLogRecPtr endptr, TimeLineID endtli)
void SendBackupManifest(backup_manifest_info *manifest, bbsink *sink)
void FreeBackupManifest(backup_manifest_info *manifest)
#define AppendToManifest(manifest,...)
static void AppendStringToManifest(backup_manifest_info *manifest, const char *s)
static bool IsManifestEnabled(backup_manifest_info *manifest)
@ MANIFEST_OPTION_FORCE_ENCODE
enum manifest_option backup_manifest_option
static void bbsink_begin_manifest(bbsink *sink)
static void bbsink_end_manifest(bbsink *sink)
static void bbsink_manifest_contents(bbsink *sink, size_t len)
void BufFileReadExact(BufFile *file, void *ptr, size_t size)
BufFile * BufFileCreateTemp(bool interXact)
int BufFileSeek(BufFile *file, int fileno, pgoff_t offset, int whence)
void BufFileWrite(BufFile *file, const void *ptr, size_t size)
void BufFileClose(BufFile *file)
#define Assert(condition)
#define OidIsValid(objectId)
int pg_checksum_final(pg_checksum_context *context, uint8 *output)
char * pg_checksum_type_name(pg_checksum_type type)
#define PG_CHECKSUM_MAX_LENGTH
const char * pg_cryptohash_error(pg_cryptohash_ctx *ctx)
int pg_cryptohash_update(pg_cryptohash_ctx *ctx, const uint8 *data, size_t len)
pg_cryptohash_ctx * pg_cryptohash_create(pg_cryptohash_type type)
int pg_cryptohash_init(pg_cryptohash_ctx *ctx)
void pg_cryptohash_free(pg_cryptohash_ctx *ctx)
int pg_cryptohash_final(pg_cryptohash_ctx *ctx, uint8 *dest, size_t len)
int errcode_for_file_access(void)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
uint64 hex_encode(const char *src, size_t len, char *dst)
void escape_json_with_len(StringInfo buf, const char *str, int len)
bool pg_verify_mbstr(int encoding, const char *mbstr, int len, bool noError)
void pfree(void *pointer)
static char buf[DEFAULT_XLOG_SEG_SIZE]
size_t pg_strftime(char *s, size_t maxsize, const char *format, const struct pg_tm *t)
struct pg_tm * pg_gmtime(const pg_time_t *timep)
#define PG_SHA256_DIGEST_LENGTH
#define PG_SHA256_DIGEST_STRING_LENGTH
void appendStringInfo(StringInfo str, const char *fmt,...)
void enlargeStringInfo(StringInfo str, int needed)
void appendStringInfoString(StringInfo str, const char *s)
void appendStringInfoChar(StringInfo str, char ch)
void initStringInfo(StringInfo str)
uint64 GetSystemIdentifier(void)
#define XLogRecPtrIsValid(r)
#define LSN_FORMAT_ARGS(lsn)