PostgreSQL Source Code
git master
|
#include "postgres.h"
#include "access/timeline.h"
#include "access/xlog.h"
#include "backup/basebackup_incremental.h"
#include "backup/walsummary.h"
#include "common/blkreftable.h"
#include "common/hashfn.h"
#include "common/int.h"
#include "common/parse_manifest.h"
#include "postmaster/walsummarizer.h"
#include "lib/simplehash.h"
Go to the source code of this file.
Data Structures | |
struct | backup_wal_range |
struct | backup_file_entry |
struct | IncrementalBackupInfo |
Macros | |
#define | BLOCKS_PER_READ 512 |
#define | MIN_CHUNK 1024 |
#define | MAX_CHUNK (128 * 1024) |
#define | SH_PREFIX backup_file |
#define | SH_ELEMENT_TYPE backup_file_entry |
#define | SH_KEY_TYPE const char * |
#define | SH_KEY path |
#define | SH_HASH_KEY(tb, key) hash_string_pointer(key) |
#define | SH_EQUAL(tb, a, b) (strcmp(a, b) == 0) |
#define | SH_SCOPE static inline |
#define | SH_DECLARE |
#define | SH_DEFINE |
#define BLOCKS_PER_READ 512 |
Definition at line 32 of file basebackup_incremental.c.
#define MAX_CHUNK (128 * 1024) |
Definition at line 40 of file basebackup_incremental.c.
#define MIN_CHUNK 1024 |
Definition at line 39 of file basebackup_incremental.c.
#define SH_DECLARE |
Definition at line 70 of file basebackup_incremental.c.
#define SH_DEFINE |
Definition at line 71 of file basebackup_incremental.c.
#define SH_ELEMENT_TYPE backup_file_entry |
Definition at line 64 of file basebackup_incremental.c.
Definition at line 68 of file basebackup_incremental.c.
#define SH_HASH_KEY | ( | tb, | |
key | |||
) | hash_string_pointer(key) |
Definition at line 67 of file basebackup_incremental.c.
#define SH_KEY path |
Definition at line 66 of file basebackup_incremental.c.
#define SH_KEY_TYPE const char * |
Definition at line 65 of file basebackup_incremental.c.
#define SH_PREFIX backup_file |
Definition at line 63 of file basebackup_incremental.c.
#define SH_SCOPE static inline |
Definition at line 69 of file basebackup_incremental.c.
void AppendIncrementalManifestData | ( | IncrementalBackupInfo * | ib, |
const char * | data, | ||
int | len | ||
) |
Definition at line 194 of file basebackup_incremental.c.
References appendBinaryStringInfo(), IncrementalBackupInfo::buf, StringInfoData::data, data, IncrementalBackupInfo::inc_state, json_parse_manifest_incremental_chunk(), StringInfoData::len, len, MAX_CHUNK, IncrementalBackupInfo::mcxt, MemoryContextSwitchTo(), and MIN_CHUNK.
Referenced by HandleUploadManifestPacket().
|
static |
Definition at line 1038 of file basebackup_incremental.c.
References a, b, and pg_cmp_u32().
Referenced by GetFileBackupMethod().
IncrementalBackupInfo* CreateIncrementalBackupInfo | ( | MemoryContext | mcxt | ) |
Definition at line 152 of file basebackup_incremental.c.
References IncrementalBackupInfo::buf, context, IncrementalBackupInfo::inc_state, initStringInfo(), json_parse_manifest_incremental_init(), IncrementalBackupInfo::manifest_files, manifest_process_file(), manifest_process_system_identifier(), manifest_process_version(), manifest_process_wal_range(), manifest_report_error(), IncrementalBackupInfo::mcxt, MemoryContextSwitchTo(), and palloc0().
Referenced by UploadManifest().
void FinalizeIncrementalManifest | ( | IncrementalBackupInfo * | ib | ) |
Definition at line 227 of file basebackup_incremental.c.
References IncrementalBackupInfo::buf, StringInfoData::data, IncrementalBackupInfo::inc_state, json_parse_manifest_incremental_chunk(), json_parse_manifest_incremental_shutdown(), StringInfoData::len, IncrementalBackupInfo::mcxt, MemoryContextSwitchTo(), and pfree().
Referenced by UploadManifest().
FileBackupMethod GetFileBackupMethod | ( | IncrementalBackupInfo * | ib, |
const char * | path, | ||
Oid | dboid, | ||
Oid | spcoid, | ||
RelFileNumber | relfilenumber, | ||
ForkNumber | forknum, | ||
unsigned | segno, | ||
size_t | size, | ||
unsigned * | num_blocks_required, | ||
BlockNumber * | relative_block_numbers, | ||
unsigned * | truncation_block_length | ||
) |
Definition at line 665 of file basebackup_incremental.c.
References Assert, BACK_UP_FILE_FULLY, BACK_UP_FILE_INCREMENTALLY, BlockNumberIsValid(), BlockRefTableEntryGetBlocks(), BlockRefTableGetEntry(), IncrementalBackupInfo::brtab, IncrementalBackupInfo::buf, compare_block_numbers(), StringInfoData::data, RelFileLocator::dbOid, ereport, errcode(), errmsg_internal(), ERROR, FSM_FORKNUM, GetIncrementalFilePath(), i, MAIN_FORKNUM, IncrementalBackupInfo::manifest_files, OidIsValid, qsort, RelFileNumberIsValid, RelFileLocator::relNumber, size, and RelFileLocator::spcOid.
Referenced by sendDir().
char* GetIncrementalFilePath | ( | Oid | dboid, |
Oid | spcoid, | ||
RelFileNumber | relfilenumber, | ||
ForkNumber | forknum, | ||
unsigned | segno | ||
) |
Definition at line 625 of file basebackup_incremental.c.
References Assert, GetRelationPath(), INVALID_PROC_NUMBER, pfree(), and psprintf().
Referenced by GetFileBackupMethod().
size_t GetIncrementalFileSize | ( | unsigned | num_blocks_required | ) |
Definition at line 897 of file basebackup_incremental.c.
References Assert, and GetIncrementalHeaderSize().
Referenced by sendDir().
size_t GetIncrementalHeaderSize | ( | unsigned | num_blocks_required | ) |
Definition at line 869 of file basebackup_incremental.c.
References Assert.
Referenced by GetIncrementalFileSize().
|
static |
|
static |
Definition at line 966 of file basebackup_incremental.c.
References context, IncrementalBackupInfo::manifest_files, MemoryContextStrdup(), backup_file_entry::path, backup_file_entry::size, and size.
Referenced by CreateIncrementalBackupInfo().
|
static |
Definition at line 944 of file basebackup_incremental.c.
References context, and GetSystemIdentifier().
Referenced by CreateIncrementalBackupInfo().
|
static |
Definition at line 930 of file basebackup_incremental.c.
References context.
Referenced by CreateIncrementalBackupInfo().
|
static |
Definition at line 993 of file basebackup_incremental.c.
References context, lappend(), IncrementalBackupInfo::manifest_wal_ranges, palloc(), and range().
Referenced by CreateIncrementalBackupInfo().
|
static |
Definition at line 1011 of file basebackup_incremental.c.
References appendStringInfoVA(), StringInfoData::data, enlargeStringInfo(), ereport, errmsg_internal(), ERROR, fmt, initStringInfo(), va_end(), and va_start().
Referenced by CreateIncrementalBackupInfo().
static void pg_attribute_noreturn | ( | ) |
void PrepareForIncrementalBackup | ( | IncrementalBackupInfo * | ib, |
BackupState * | backup_state | ||
) |
Definition at line 263 of file basebackup_incremental.c.
References Assert, backup_state, TimeLineHistoryEntry::begin, BlockRefTableMarkBlockModified(), BlockRefTableReaderGetBlocks(), BlockRefTableReaderNextRelation(), BlockRefTableSetLimitBlock(), BLOCKS_PER_READ, IncrementalBackupInfo::brtab, IncrementalBackupInfo::buf, CreateBlockRefTableReader(), StringInfoData::data, DEBUG1, DestroyBlockRefTableReader(), TimeLineHistoryEntry::end, ereport, errcode(), errdetail(), errhint(), errmsg(), errmsg_internal(), ERROR, expectedTLEs, WalSummaryIO::file, FileClose(), FilePathName(), WalSummaryIO::filepos, FilterWalSummaries(), GetWalSummaries(), i, InvalidXLogRecPtr, BackupState::istartpoint, BackupState::istarttli, lfirst, list_concat(), list_length(), list_nth(), LSN_FORMAT_ARGS, IncrementalBackupInfo::manifest_wal_ranges, IncrementalBackupInfo::mcxt, MemoryContextSwitchTo(), NIL, OpenWalSummaryFile(), palloc0(), range(), readTimeLineHistory(), ReadWalSummary(), ReportWalSummaryError(), BackupState::startpoint, BackupState::starttli, TimeLineHistoryEntry::tli, WaitForWalSummarization(), WalSummariesAreComplete(), and XLogRecPtrIsInvalid.
Referenced by perform_base_backup().