PostgreSQL Source Code
git master
|
#include "postgres_fe.h"
#include <ctype.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include "common/string.h"
#include "compress_io.h"
#include "dumputils.h"
#include "fe_utils/string_utils.h"
#include "lib/stringinfo.h"
#include "libpq/libpq-fs.h"
#include "parallel.h"
#include "pg_backup_archiver.h"
#include "pg_backup_db.h"
#include "pg_backup_utils.h"
Go to the source code of this file.
Data Structures | |
struct | _parallelReadyList |
Macros | |
#define | TEXT_DUMP_HEADER "--\n-- PostgreSQL database dump\n--\n\n" |
#define | TEXT_DUMPALL_HEADER "--\n-- PostgreSQL database cluster dump\n--\n\n" |
Typedefs | |
typedef struct _parallelReadyList | ParallelReadyList |
#define TEXT_DUMP_HEADER "--\n-- PostgreSQL database dump\n--\n\n" |
Definition at line 44 of file pg_backup_archiver.c.
#define TEXT_DUMPALL_HEADER "--\n-- PostgreSQL database cluster dump\n--\n\n" |
Definition at line 45 of file pg_backup_archiver.c.
typedef struct _parallelReadyList ParallelReadyList |
|
static |
Definition at line 2228 of file pg_backup_archiver.c.
References _discoverArchiveFormat(), pg_compress_specification::algorithm, archCustom, archDirectory, _archiveHandle::archiveDumpVersion, archModeWrite, archNull, archTar, archUnknown, _archiveHandle::compression_spec, _archiveHandle::createDate, _archiveHandle::currSchema, _archiveHandle::currTableAm, _archiveHandle::currTablespace, _archiveHandle::currUser, _archiveHandle::dosync, dosync, Archive::encoding, Archive::exit_on_error, fmt, _archiveHandle::format, _archiveHandle::fSpec, InitArchiveFmt_Custom(), InitArchiveFmt_Directory(), InitArchiveFmt_Null(), InitArchiveFmt_Tar(), InitCompressFileHandle(), _archiveHandle::intSize, K_VERS_SELF, mode, _archiveHandle::mode, Archive::n_errors, _tocEntry::next, _archiveHandle::OF, _archiveHandle::offSize, CompressFileHandle::open_func, PG_BINARY_A, PG_COMPRESSION_NONE, pg_fatal, pg_log_debug, pg_malloc0(), pg_strdup(), pgoff_t, _tocEntry::prev, _archiveHandle::public, _archiveHandle::SetupWorkerPtr, _archiveHandle::sqlparse, Archive::std_strings, generate_unaccent_rules::stdout, _archiveHandle::toc, and _archiveHandle::version.
Referenced by CreateArchive(), and OpenArchive().
|
static |
Definition at line 3262 of file pg_backup_archiver.c.
References _becomeUser(), _restoreOptions::noOwner, _tocEntry::owner, _archiveHandle::public, Archive::ropt, and _restoreOptions::use_setsessauth.
Referenced by _printTocEntry(), restore_toc_entry(), and RestoreArchive().
|
static |
Definition at line 3239 of file pg_backup_archiver.c.
References _doSetSessionAuth(), _archiveHandle::currUser, free, pg_strdup(), and user.
Referenced by _becomeOwner(), _disableTriggersIfNecessary(), and _enableTriggersIfNecessary().
|
static |
Definition at line 999 of file pg_backup_archiver.c.
References _becomeUser(), ahprintf(), _restoreOptions::dataOnly, _restoreOptions::disable_triggers, fmtQualifiedId(), pg_log_info, _archiveHandle::public, Archive::ropt, _restoreOptions::superuser, and _tocEntry::tag.
Referenced by restore_toc_entry().
|
static |
Definition at line 2098 of file pg_backup_archiver.c.
References _fileExistsInDirectory(), archCustom, archDirectory, archTar, _archiveHandle::format, free, _archiveHandle::fSpec, isValidTarHeader(), _archiveHandle::lookahead, _archiveHandle::lookaheadLen, _archiveHandle::lookaheadPos, _archiveHandle::lookaheadSize, PG_BINARY_R, pg_fatal, pg_log_debug, pg_malloc0(), READ_ERROR_EXIT, _archiveHandle::readHeader, S_ISDIR, sig, stat::st_mode, stat, TEXT_DUMP_HEADER, and TEXT_DUMPALL_HEADER.
Referenced by _allocAH().
|
static |
Definition at line 3102 of file pg_backup_archiver.c.
References ahprintf(), _restoreOptions::enable_row_security, Archive::encoding, fmtId(), pg_encoding_to_char(), _archiveHandle::public, Archive::ropt, Archive::searchpath, Archive::std_strings, and _restoreOptions::use_role.
Referenced by _reconnectToDB(), CloneArchive(), restore_toc_entries_postfork(), and RestoreArchive().
|
static |
Definition at line 3155 of file pg_backup_archiver.c.
References ahprintf(), appendPQExpBufferChar(), appendPQExpBufferStr(), appendStringLiteralAHX, _archiveHandle::connection, createPQExpBuffer(), PQExpBufferData::data, destroyPQExpBuffer(), pg_fatal, PGRES_COMMAND_OK, PQclear(), PQerrorMessage(), PQexec(), PQresultStatus(), res, RestoringToDB(), and user.
Referenced by _becomeUser().
|
static |
Definition at line 1025 of file pg_backup_archiver.c.
References _becomeUser(), ahprintf(), _restoreOptions::dataOnly, _restoreOptions::disable_triggers, fmtQualifiedId(), pg_log_info, _archiveHandle::public, Archive::ropt, _restoreOptions::superuser, and _tocEntry::tag.
Referenced by restore_toc_entry().
|
static |
Definition at line 2086 of file pg_backup_archiver.c.
References buf, filename, MAXPGPATH, pg_fatal, S_ISREG, snprintf, stat::st_mode, and stat.
Referenced by _discoverArchiveFormat().
|
static |
Definition at line 3442 of file pg_backup_archiver.c.
References appendPQExpBuffer(), appendPQExpBufferStr(), buf, _tocEntry::desc, _tocEntry::dropStmt, fmtId(), free, pg_fatal, pg_strdup(), _tocEntry::tag, and generate_unaccent_rules::type.
Referenced by _printTocEntry().
Definition at line 1818 of file pg_backup_archiver.c.
References _tocEntry::next, and _tocEntry::prev.
Referenced by SortTocFromFile().
|
static |
Definition at line 3535 of file pg_backup_archiver.c.
References _becomeOwner(), _getObjectDescription(), _selectOutputSchema(), _selectTableAccessMethod(), _selectTablespace(), _tocEntryIsACL(), ahprintf(), _tocEntry::catalogId, _archiveHandle::currUser, PQExpBufferData::data, _tocEntry::defn, _tocEntry::dependencies, _tocEntry::desc, _tocEntry::dropStmt, _tocEntry::dumpId, fmtId(), free, i, initPQExpBuffer(), _tocEntry::nDeps, _restoreOptions::noOwner, _restoreOptions::noTablespace, _archiveHandle::noTocComments, CatalogId::oid, _tocEntry::owner, _archiveHandle::PrintExtraTocPtr, _archiveHandle::public, Archive::ropt, sanitize_line(), _tocEntry::tableam, CatalogId::tableoid, _tocEntry::tablespace, _tocEntry::tag, termPQExpBuffer(), _restoreOptions::use_setsessauth, and Archive::verbose.
Referenced by restore_toc_entry().
|
static |
Definition at line 3198 of file pg_backup_archiver.c.
References _doSetFixedOutputState(), ahprintf(), appendPsqlMetaConnect(), _archiveHandle::currSchema, _archiveHandle::currTableAm, _archiveHandle::currTablespace, _archiveHandle::currUser, PQExpBufferData::data, dbname, free, initPQExpBuffer(), ReconnectToServer(), RestoringToDB(), and termPQExpBuffer().
Referenced by restore_toc_entry().
|
static |
Definition at line 3278 of file pg_backup_archiver.c.
References ahprintf(), appendPQExpBuffer(), appendPQExpBufferStr(), _archiveHandle::connection, createPQExpBuffer(), _archiveHandle::currSchema, PQExpBufferData::data, destroyPQExpBuffer(), fmtId(), free, pg_strdup(), PGRES_COMMAND_OK, PQclear(), PQerrorMessage(), PQexec(), PQresultStatus(), _archiveHandle::public, res, RestoringToDB(), Archive::searchpath, and warn_or_exit_horribly().
Referenced by _printTocEntry(), restore_toc_entry(), and RestoreArchive().
|
static |
Definition at line 3389 of file pg_backup_archiver.c.
References ahprintf(), appendPQExpBuffer(), _archiveHandle::connection, createPQExpBuffer(), _archiveHandle::currTableAm, PQExpBufferData::data, destroyPQExpBuffer(), fmtId(), free, _restoreOptions::noTableAm, pg_strdup(), PGRES_COMMAND_OK, PQclear(), PQerrorMessage(), PQexec(), PQresultStatus(), _archiveHandle::public, res, RestoringToDB(), Archive::ropt, and warn_or_exit_horribly().
Referenced by _printTocEntry().
|
static |
Definition at line 3329 of file pg_backup_archiver.c.
References ahprintf(), appendPQExpBuffer(), appendPQExpBufferStr(), _archiveHandle::connection, createPQExpBuffer(), _archiveHandle::currTablespace, PQExpBufferData::data, destroyPQExpBuffer(), fmtId(), free, _restoreOptions::noTablespace, pg_strdup(), PGRES_COMMAND_OK, PQclear(), PQerrorMessage(), PQexec(), PQresultStatus(), _archiveHandle::public, res, RestoringToDB(), Archive::ropt, tablespace, and warn_or_exit_horribly().
Referenced by _printTocEntry().
Definition at line 3087 of file pg_backup_archiver.c.
References _tocEntry::desc.
Referenced by _printTocEntry(), and _tocEntryRequired().
|
static |
Definition at line 2793 of file pg_backup_archiver.c.
References _tocEntryIsACL(), _restoreOptions::aclsSkip, _restoreOptions::binary_upgrade, _restoreOptions::createDB, _restoreOptions::dataOnly, _tocEntry::defn, _tocEntry::dependencies, _tocEntry::desc, DUMP_DATA, DUMP_POST_DATA, DUMP_PRE_DATA, _tocEntry::dumpId, _restoreOptions::dumpSections, _restoreOptions::functionNames, _tocEntry::hadDumper, SimpleStringList::head, _restoreOptions::idWanted, _restoreOptions::indexNames, _tocEntry::nDeps, _restoreOptions::no_comments, _restoreOptions::no_publications, _restoreOptions::no_security_labels, _restoreOptions::no_subscriptions, _archiveHandle::public, REQ_DATA, REQ_SCHEMA, REQ_SPECIAL, res, Archive::ropt, _restoreOptions::schemaExcludeNames, _restoreOptions::schemaNames, _restoreOptions::schemaOnly, SECTION_DATA, SECTION_POST_DATA, SECTION_PRE_DATA, _restoreOptions::selFunction, _restoreOptions::selIndex, _restoreOptions::selTable, _restoreOptions::selTrigger, _restoreOptions::selTypes, _restoreOptions::sequence_data, simple_string_list_member(), _restoreOptions::tableNames, _tocEntry::tag, TocIDRequired(), and _restoreOptions::triggerNames.
Referenced by PrintTOCSummary(), and ProcessArchiveRestoreOptions().
|
static |
Definition at line 3054 of file pg_backup_archiver.c.
References _tocEntry::desc, RESTORE_PASS_ACL, RESTORE_PASS_MAIN, and _tocEntry::tag.
Referenced by move_to_ready_list(), reduce_dependencies(), restore_toc_entries_prefork(), and RestoreArchive().
int ahprintf | ( | ArchiveHandle * | AH, |
const char * | fmt, | ||
... | |||
) |
Definition at line 1613 of file pg_backup_archiver.c.
References ahwrite(), generate_unaccent_rules::args, fmt, free, len, pg_malloc(), pvsnprintf(), va_end(), and va_start().
Referenced by _disableTriggersIfNecessary(), _doSetFixedOutputState(), _doSetSessionAuth(), _enableTriggersIfNecessary(), _EndData(), _EndLO(), _EndLOs(), _PrintExtraToc(), _PrintTocData(), _printTocEntry(), _reconnectToDB(), _selectOutputSchema(), _selectTableAccessMethod(), _selectTablespace(), _StartLO(), _StartLOs(), _WriteLOData(), DropLOIfExists(), dump_lo_buf(), dumpTimestamp(), EndRestoreLO(), EndRestoreLOs(), PrintTOCSummary(), restore_toc_entry(), RestoreArchive(), StartRestoreLO(), and StartRestoreLOs().
void ahwrite | ( | const void * | ptr, |
size_t | size, | ||
size_t | nmemb, | ||
ArchiveHandle * | AH | ||
) |
Definition at line 1704 of file pg_backup_archiver.c.
References _archiveHandle::CustomOutPtr, dump_lo_buf(), ExecuteSqlCommandBuf(), if(), _archiveHandle::lo_buf, _archiveHandle::lo_buf_size, _archiveHandle::lo_buf_used, _archiveHandle::OF, _archiveHandle::public, remaining, RestoringToDB(), WRITE_ERROR_EXIT, CompressFileHandle::write_func, and _archiveHandle::writingLO.
Referenced by _LoadLOs(), _PrintFileData(), _PrintTocData(), _WriteData(), ahprintf(), and ReadDataFromArchiveNone().
TocEntry* ArchiveEntry | ( | Archive * | AHX, |
CatalogId | catalogId, | ||
DumpId | dumpId, | ||
ArchiveOpts * | opts | ||
) |
Definition at line 1114 of file pg_backup_archiver.c.
References _archiveHandle::ArchiveEntryPtr, _tocEntry::catalogId, _tocEntry::copyStmt, _tocEntry::dataDumper, _tocEntry::dataDumperArg, _tocEntry::dataLength, _tocEntry::defn, _tocEntry::dependencies, _tocEntry::desc, _tocEntry::dropStmt, _tocEntry::dumpId, _tocEntry::formatData, _tocEntry::hadDumper, _archiveHandle::maxDumpId, _tocEntry::nDeps, _tocEntry::next, opts, _tocEntry::owner, pg_malloc(), pg_malloc0(), pg_strdup(), _tocEntry::prev, _tocEntry::section, _tocEntry::tableam, _tocEntry::tablespace, _tocEntry::tag, _archiveHandle::toc, _archiveHandle::tocCount, and true.
Referenced by dumpAccessMethod(), dumpACL(), dumpAgg(), dumpAttrDef(), dumpBaseType(), dumpCast(), dumpCollation(), dumpCommentExtended(), dumpCompositeType(), dumpCompositeTypeColComments(), dumpConstraint(), dumpConversion(), dumpDatabase(), dumpDefaultACL(), dumpDomain(), dumpDumpableObject(), dumpEncoding(), dumpEnumType(), dumpEventTrigger(), dumpExtension(), dumpForeignDataWrapper(), dumpForeignServer(), dumpFunc(), dumpIndex(), dumpIndexAttach(), dumpLO(), dumpNamespace(), dumpOpclass(), dumpOpfamily(), dumpOpr(), dumpPolicy(), dumpProcLang(), dumpPublication(), dumpPublicationNamespace(), dumpPublicationTable(), dumpRangeType(), dumpRule(), dumpSearchPath(), dumpSecLabel(), dumpSequence(), dumpSequenceData(), dumpShellType(), dumpStatisticsExt(), dumpStdStrings(), dumpSubscription(), dumpTableAttach(), dumpTableComment(), dumpTableData(), dumpTableSchema(), dumpTableSecLabel(), dumpTransform(), dumpTrigger(), dumpTSConfig(), dumpTSDictionary(), dumpTSParser(), dumpTSTemplate(), dumpUndefinedType(), dumpUserMappings(), and refreshMatViewData().
int archprintf | ( | Archive * | AH, |
const char * | fmt, | ||
... | |||
) |
Definition at line 1513 of file pg_backup_archiver.c.
References generate_unaccent_rules::args, fmt, free, len, pg_malloc(), pvsnprintf(), va_end(), va_start(), and WriteData().
void archputs | ( | const char * | s, |
Archive * | AH | ||
) |
Definition at line 1506 of file pg_backup_archiver.c.
References WriteData().
Referenced by dumpTableData_insert().
|
static |
Definition at line 1843 of file pg_backup_archiver.c.
References _tocEntry::dependencies, _tocEntry::desc, _tocEntry::dumpId, _archiveHandle::maxDumpId, _tocEntry::nDeps, _tocEntry::next, pg_fatal, pg_malloc0(), _archiveHandle::tableDataId, _archiveHandle::toc, and _archiveHandle::tocsByDumpId.
Referenced by getTocEntryByDumpId(), and RestoreArchive().
bool checkSeek | ( | FILE * | fp | ) |
Definition at line 3858 of file pg_backup_archiver.c.
References fseeko, ftello, and pgoff_t.
Referenced by InitArchiveFmt_Custom(), and InitArchiveFmt_Tar().
ArchiveHandle* CloneArchive | ( | ArchiveHandle * | AH | ) |
Definition at line 4778 of file pg_backup_archiver.c.
References _doSetFixedOutputState(), archModeRead, Assert(), _archiveHandle::ClonePtr, _archiveHandle::connCancel, ConnectDatabase(), _archiveHandle::connection, _restoreOptions::cparams, _archiveHandle::currSchema, _archiveHandle::currTableAm, _archiveHandle::currTablespace, _archiveHandle::currUser, _archiveHandle::mode, Archive::n_errors, pg_malloc(), pg_strdup(), _archiveHandle::public, Archive::ropt, _archiveHandle::savedPassword, and _archiveHandle::sqlparse.
Referenced by RunWorker().
void CloseArchive | ( | Archive * | AHX | ) |
Definition at line 267 of file pg_backup_archiver.c.
References _archiveHandle::ClosePtr, EndCompressFileHandle(), _archiveHandle::OF, and pg_fatal.
Referenced by main().
Archive* CreateArchive | ( | const char * | FileSpec, |
const ArchiveFormat | fmt, | ||
const pg_compress_specification | compression_spec, | ||
bool | dosync, | ||
ArchiveMode | mode, | ||
SetupWorkerPtrType | setupDumpWorker | ||
) |
Definition at line 238 of file pg_backup_archiver.c.
References _allocAH(), dosync, fmt, mode, and setupDumpWorker().
Referenced by main().
void DeCloneArchive | ( | ArchiveHandle * | AH | ) |
Definition at line 4828 of file pg_backup_archiver.c.
References Assert(), _archiveHandle::connection, sqlparseInfo::curCmd, _archiveHandle::currSchema, _archiveHandle::currTableAm, _archiveHandle::currTablespace, _archiveHandle::currUser, _archiveHandle::DeClonePtr, destroyPQExpBuffer(), free, _archiveHandle::savedPassword, and _archiveHandle::sqlparse.
Referenced by RunWorker().
|
static |
Definition at line 1661 of file pg_backup_archiver.c.
References ahprintf(), appendByteaLiteralAHX, buf, _archiveHandle::connection, createPQExpBuffer(), destroyPQExpBuffer(), _archiveHandle::lo_buf, _archiveHandle::lo_buf_used, lo_write(), _archiveHandle::loFd, ngettext, pg_log_debug, PQerrorMessage(), res, warn_or_exit_horribly(), and _archiveHandle::writingLO.
Referenced by ahwrite(), and EndRestoreLO().
DumpOptions* dumpOptionsFromRestoreOptions | ( | RestoreOptions * | ropt | ) |
Definition at line 174 of file pg_backup_archiver.c.
References _restoreOptions::aclsSkip, _dumpOptions::aclsSkip, _restoreOptions::column_inserts, _dumpOptions::column_inserts, _restoreOptions::cparams, _dumpOptions::cparams, _restoreOptions::createDB, _restoreOptions::dataOnly, _dumpOptions::dataOnly, _connParams::dbname, _restoreOptions::disable_dollar_quoting, _dumpOptions::disable_dollar_quoting, _restoreOptions::disable_triggers, _dumpOptions::disable_triggers, _restoreOptions::dropSchema, _restoreOptions::dump_inserts, _dumpOptions::dump_inserts, _restoreOptions::dumpSections, _dumpOptions::dumpSections, _restoreOptions::enable_row_security, _dumpOptions::enable_row_security, _restoreOptions::if_exists, _dumpOptions::if_exists, _restoreOptions::include_everything, _dumpOptions::include_everything, _restoreOptions::lockWaitTimeout, _dumpOptions::lockWaitTimeout, NewDumpOptions(), _restoreOptions::no_comments, _dumpOptions::no_comments, _restoreOptions::no_publications, _dumpOptions::no_publications, _restoreOptions::no_security_labels, _dumpOptions::no_security_labels, _restoreOptions::no_subscriptions, _dumpOptions::no_subscriptions, _restoreOptions::noOwner, _restoreOptions::noTableAm, _restoreOptions::noTablespace, _dumpOptions::outputClean, _dumpOptions::outputCreateDB, _dumpOptions::outputNoOwner, _dumpOptions::outputNoTableAm, _dumpOptions::outputNoTablespaces, _dumpOptions::outputSuperuser, pg_strdup(), _connParams::pghost, _connParams::pgport, _connParams::promptPassword, _restoreOptions::schemaOnly, _dumpOptions::schemaOnly, _restoreOptions::sequence_data, _dumpOptions::sequence_data, _restoreOptions::superuser, _restoreOptions::use_setsessauth, _dumpOptions::use_setsessauth, and _connParams::username.
Referenced by SetArchiveOptions().
|
static |
Definition at line 3883 of file pg_backup_archiver.c.
References ahprintf(), buf, and PGDUMP_STRFTIME_FMT.
Referenced by RestoreArchive().
Definition at line 1295 of file pg_backup_archiver.c.
References _archiveHandle::currToc, and _archiveHandle::EndLOPtr.
Referenced by dumpLOs().
void EndRestoreLO | ( | ArchiveHandle * | AH, |
Oid | oid | ||
) |
Definition at line 1399 of file pg_backup_archiver.c.
References ahprintf(), _archiveHandle::connection, dump_lo_buf(), _archiveHandle::lo_buf_used, lo_close(), _archiveHandle::loFd, and _archiveHandle::writingLO.
Referenced by _LoadLOs().
void EndRestoreLOs | ( | ArchiveHandle * | AH | ) |
Definition at line 1332 of file pg_backup_archiver.c.
References ahprintf(), CommitTransaction(), _archiveHandle::connection, _archiveHandle::loCount, ngettext, pg_log_info, _archiveHandle::public, Archive::ropt, and _restoreOptions::single_txn.
Referenced by _LoadLOs().
|
static |
Definition at line 4475 of file pg_backup_archiver.c.
References _tocEntry::depCount, _tocEntry::dependencies, _tocEntry::desc, _tocEntry::dumpId, i, identify_locking_dependencies(), K_VERS_1_11, _tocEntry::lockDeps, _tocEntry::nDeps, _tocEntry::next, _tocEntry::nLockDeps, _tocEntry::nRevDeps, _tocEntry::pending_next, _tocEntry::pending_prev, pg_malloc(), repoint_table_dependencies(), _tocEntry::revDeps, _archiveHandle::toc, _archiveHandle::tocsByDumpId, and _archiveHandle::version.
Referenced by IndexSetParentIndex(), and restore_toc_entries_prefork().
TocEntry* getTocEntryByDumpId | ( | ArchiveHandle * | AH, |
DumpId | id | ||
) |
Definition at line 1884 of file pg_backup_archiver.c.
References buildTocEntryArrays(), and _archiveHandle::tocsByDumpId.
Referenced by _PrintTocData(), parseWorkerCommand(), SortTocFromFile(), and TocIDRequired().
Definition at line 4166 of file pg_backup_archiver.c.
References _tocEntry::dependencies, j, _tocEntry::lockDeps, _tocEntry::nDeps, and _tocEntry::nLockDeps.
Referenced by pop_next_work_item().
|
static |
Definition at line 4639 of file pg_backup_archiver.c.
References _tocEntry::dependencies, _tocEntry::desc, free, i, _tocEntry::lockDeps, _tocEntry::nDeps, _tocEntry::nLockDeps, pg_malloc(), pg_realloc(), _tocEntry::section, SECTION_POST_DATA, and _archiveHandle::tocsByDumpId.
Referenced by fix_dependencies().
|
static |
Definition at line 4758 of file pg_backup_archiver.c.
References _tocEntry::dumpId, pg_log_info, _tocEntry::reqs, _archiveHandle::tableDataId, _tocEntry::tag, and _archiveHandle::tocsByDumpId.
Referenced by mark_restore_job_done(), and restore_toc_entry().
void InitDumpOptions | ( | DumpOptions * | opts | ) |
Definition at line 160 of file pg_backup_archiver.c.
References DUMP_UNSECTIONED, opts, and TRI_DEFAULT.
Referenced by main(), and NewDumpOptions().
Definition at line 1062 of file pg_backup_archiver.c.
References appendPQExpBuffer(), _tocEntry::copyStmt, createPQExpBuffer(), PQExpBufferData::data, _tocEntry::defn, destroyPQExpBuffer(), fmtQualifiedId(), PQExpBufferData::len, and _tocEntry::tag.
Referenced by restore_toc_entry().
|
static |
Definition at line 4743 of file pg_backup_archiver.c.
References _tocEntry::created, _tocEntry::dumpId, _archiveHandle::tableDataId, and _archiveHandle::tocsByDumpId.
Referenced by mark_restore_job_done(), and restore_toc_entry().
|
static |
Definition at line 2413 of file pg_backup_archiver.c.
References _tocEntry::desc, _tocEntry::dumpId, pg_fatal, pg_log_info, and _tocEntry::tag.
Referenced by WriteDataChunks().
|
static |
Definition at line 4434 of file pg_backup_archiver.c.
References _tocEntry::desc, _tocEntry::dumpId, inhibit_data_for_failed_table(), mark_create_done(), Archive::n_errors, pg_fatal, pg_log_info, _archiveHandle::public, reduce_dependencies(), _tocEntry::tag, WORKER_CREATE_DONE, WORKER_IGNORED_ERRORS, and WORKER_INHIBIT_DATA.
Referenced by restore_toc_entries_parallel().
|
static |
Definition at line 4319 of file pg_backup_archiver.c.
References _tocEntryRestorePass(), _tocEntry::depCount, pending_list_remove(), _tocEntry::pending_next, and ready_list_insert().
Referenced by restore_toc_entries_parallel().
DumpOptions* NewDumpOptions | ( | void | ) |
Definition at line 148 of file pg_backup_archiver.c.
References InitDumpOptions(), opts, and pg_malloc().
Referenced by dumpOptionsFromRestoreOptions().
RestoreOptions* NewRestoreOptions | ( | void | ) |
Definition at line 982 of file pg_backup_archiver.c.
References archUnknown, DUMP_UNSECTIONED, opts, PG_COMPRESSION_NONE, pg_malloc0(), and TRI_DEFAULT.
Referenced by _CloseArchive(), and main().
Archive* OpenArchive | ( | const char * | FileSpec, |
const ArchiveFormat | fmt | ||
) |
Definition at line 253 of file pg_backup_archiver.c.
References _allocAH(), pg_compress_specification::algorithm, archModeRead, fmt, PG_COMPRESSION_NONE, and setupRestoreWorker().
Referenced by main().
int parallel_restore | ( | ArchiveHandle * | AH, |
TocEntry * | te | ||
) |
Definition at line 4411 of file pg_backup_archiver.c.
References Assert(), _archiveHandle::connection, Archive::n_errors, _archiveHandle::public, and restore_toc_entry().
Referenced by _WorkerJobRestoreCustom(), and _WorkerJobRestoreDirectory().
Definition at line 4198 of file pg_backup_archiver.c.
References _tocEntry::pending_next, and _tocEntry::pending_prev.
Referenced by restore_toc_entries_prefork().
|
static |
Definition at line 4191 of file pg_backup_archiver.c.
References _tocEntry::pending_next, and _tocEntry::pending_prev.
Referenced by RestoreArchive().
|
static |
Definition at line 4208 of file pg_backup_archiver.c.
References _tocEntry::pending_next, and _tocEntry::pending_prev.
Referenced by move_to_ready_list(), and reduce_dependencies().
|
static |
Definition at line 4354 of file pg_backup_archiver.c.
References _parallelReadyList::first_te, has_lock_conflicts(), i, ParallelState::numWorkers, pg_log_debug, ready_list_remove(), ready_list_sort(), ParallelState::te, and _parallelReadyList::tes.
Referenced by restore_toc_entries_parallel().
void PrintTOCSummary | ( | Archive * | AHX | ) |
Definition at line 1172 of file pg_backup_archiver.c.
References _tocEntryRequired(), ahprintf(), pg_compress_specification::algorithm, archCustom, _archiveHandle::archdbname, archDirectory, ARCHIVE_MAJOR, ARCHIVE_MINOR, ARCHIVE_REV, _archiveHandle::archiveDumpVersion, _archiveHandle::archiveRemoteVersion, archTar, _tocEntry::catalogId, _archiveHandle::compression_spec, _archiveHandle::createDate, _tocEntry::dependencies, _tocEntry::desc, _tocEntry::dumpId, _restoreOptions::filename, _archiveHandle::format, free, get_compress_algorithm_name(), i, _archiveHandle::intSize, _tocEntry::nDeps, _tocEntry::next, _archiveHandle::offSize, CatalogId::oid, _tocEntry::owner, PG_COMPRESSION_NONE, PGDUMP_STRFTIME_FMT, _archiveHandle::public, REQ_DATA, REQ_SCHEMA, RestoreOutput(), Archive::ropt, sanitize_line(), SaveOutput(), _tocEntry::section, SECTION_NONE, SECTION_PRE_DATA, SetOutput(), _restoreOptions::strict_names, StrictNamesCheck(), CatalogId::tableoid, _tocEntry::tag, _archiveHandle::toc, _archiveHandle::tocCount, _restoreOptions::verbose, and _archiveHandle::version.
Referenced by main().
void ProcessArchiveRestoreOptions | ( | Archive * | AHX | ) |
Definition at line 294 of file pg_backup_archiver.c.
References _tocEntryRequired(), archModeRead, _archiveHandle::mode, _tocEntry::next, pg_fatal, pg_log_warning, _archiveHandle::public, _tocEntry::reqs, Archive::ropt, _tocEntry::section, SECTION_DATA, SECTION_NONE, SECTION_POST_DATA, SECTION_PRE_DATA, _restoreOptions::strict_names, StrictNamesCheck(), and _archiveHandle::toc.
Referenced by main().
|
static |
Definition at line 2689 of file pg_backup_archiver.c.
References _tocEntry::defn, Archive::encoding, encoding, free, pg_char_to_encoding(), pg_fatal, pg_strdup(), and _archiveHandle::public.
Referenced by ReadToc().
|
static |
Definition at line 2733 of file pg_backup_archiver.c.
References _tocEntry::defn, pg_strdup(), _archiveHandle::public, and Archive::searchpath.
Referenced by ReadToc().
|
static |
Definition at line 2717 of file pg_backup_archiver.c.
References _tocEntry::defn, pg_fatal, _archiveHandle::public, and Archive::std_strings.
Referenced by ReadToc().
void ReadHead | ( | ArchiveHandle * | AH | ) |
Definition at line 3724 of file pg_backup_archiver.c.
References pg_compress_specification::algorithm, _archiveHandle::archdbname, _archiveHandle::archiveDumpVersion, _archiveHandle::archiveRemoteVersion, _archiveHandle::compression_spec, _archiveHandle::createDate, errmsg(), fmt, _archiveHandle::format, _archiveHandle::intSize, K_VERS_1_0, K_VERS_1_10, K_VERS_1_15, K_VERS_1_2, K_VERS_1_4, K_VERS_1_7, K_VERS_MAX, pg_compress_specification::level, MAKE_ARCHIVE_VERSION, _archiveHandle::offSize, PG_COMPRESSION_GZIP, pg_fatal, pg_free(), pg_log_warning, _archiveHandle::ReadBufPtr, _archiveHandle::ReadBytePtr, _archiveHandle::readHeader, ReadInt(), ReadStr(), supports_compression(), tm, pg_tm::tm_sec, and _archiveHandle::version.
Referenced by InitArchiveFmt_Custom(), InitArchiveFmt_Directory(), and InitArchiveFmt_Tar().
int ReadInt | ( | ArchiveHandle * | AH | ) |
Definition at line 2020 of file pg_backup_archiver.c.
References b, _archiveHandle::intSize, K_VERS_1_0, _archiveHandle::ReadBytePtr, res, sign, and _archiveHandle::version.
Referenced by _CustomReadFunc(), _LoadLOs(), _readBlockHeader(), _ReadExtraToc(), _skipData(), _skipLOs(), ReadHead(), ReadOffset(), ReadStr(), and ReadToc().
int ReadOffset | ( | ArchiveHandle * | AH, |
pgoff_t * | o | ||
) |
Definition at line 1925 of file pg_backup_archiver.c.
References i, K_OFFSET_NO_DATA, K_OFFSET_POS_NOT_SET, K_OFFSET_POS_SET, K_VERS_1_7, _archiveHandle::offSize, pg_fatal, pgoff_t, _archiveHandle::ReadBytePtr, ReadInt(), and _archiveHandle::version.
Referenced by _ReadExtraToc().
char* ReadStr | ( | ArchiveHandle * | AH | ) |
Definition at line 2066 of file pg_backup_archiver.c.
References buf, pg_malloc(), _archiveHandle::ReadBufPtr, and ReadInt().
Referenced by _ReadExtraToc(), ReadHead(), and ReadToc().
void ReadToc | ( | ArchiveHandle * | AH | ) |
Definition at line 2520 of file pg_backup_archiver.c.
References _tocEntry::catalogId, _tocEntry::copyStmt, _tocEntry::dataLength, _tocEntry::defn, _tocEntry::dependencies, _tocEntry::desc, _tocEntry::dropStmt, _tocEntry::dumpId, free, _tocEntry::hadDumper, i, InvalidOid, K_VERS_1_10, K_VERS_1_11, K_VERS_1_14, K_VERS_1_3, K_VERS_1_5, K_VERS_1_6, K_VERS_1_8, K_VERS_1_9, _archiveHandle::maxDumpId, _tocEntry::nDeps, _tocEntry::next, CatalogId::oid, _tocEntry::owner, pg_fatal, pg_log_debug, pg_log_warning, pg_malloc(), pg_malloc0(), pg_realloc(), _tocEntry::prev, processEncodingEntry(), processSearchPathEntry(), processStdStringsEntry(), _archiveHandle::ReadExtraTocPtr, ReadInt(), ReadStr(), _tocEntry::section, SECTION_DATA, SECTION_NONE, SECTION_POST_DATA, SECTION_PRE_DATA, _tocEntry::tableam, CatalogId::tableoid, _tocEntry::tablespace, _tocEntry::tag, _archiveHandle::toc, _archiveHandle::tocCount, and _archiveHandle::version.
Referenced by InitArchiveFmt_Custom(), InitArchiveFmt_Directory(), and InitArchiveFmt_Tar().
|
static |
Definition at line 4234 of file pg_backup_archiver.c.
References pg_free(), and _parallelReadyList::tes.
Referenced by restore_toc_entries_parallel().
|
static |
Definition at line 4221 of file pg_backup_archiver.c.
References _parallelReadyList::first_te, _parallelReadyList::last_te, pg_malloc(), _parallelReadyList::sorted, and _parallelReadyList::tes.
Referenced by restore_toc_entries_parallel().
|
static |
Definition at line 4241 of file pg_backup_archiver.c.
References _parallelReadyList::last_te, _parallelReadyList::sorted, and _parallelReadyList::tes.
Referenced by move_to_ready_list(), and reduce_dependencies().
|
static |
Definition at line 4250 of file pg_backup_archiver.c.
References Assert(), _parallelReadyList::first_te, i, and _parallelReadyList::tes.
Referenced by pop_next_work_item().
|
static |
Definition at line 4274 of file pg_backup_archiver.c.
References _parallelReadyList::first_te, _parallelReadyList::last_te, qsort, _parallelReadyList::sorted, _parallelReadyList::tes, and TocEntrySizeCompare().
Referenced by pop_next_work_item().
|
static |
Definition at line 4703 of file pg_backup_archiver.c.
References _tocEntryRestorePass(), Assert(), _tocEntry::depCount, _tocEntry::dumpId, i, _tocEntry::nRevDeps, pending_list_remove(), _tocEntry::pending_prev, pg_log_debug, ready_list_insert(), _archiveHandle::restorePass, _tocEntry::revDeps, and _archiveHandle::tocsByDumpId.
Referenced by mark_restore_job_done(), restore_toc_entries_parallel(), and restore_toc_entries_prefork().
|
static |
Definition at line 4605 of file pg_backup_archiver.c.
References _tocEntry::dataLength, _tocEntry::dependencies, _tocEntry::dumpId, i, Max, _tocEntry::nDeps, _tocEntry::next, pg_log_debug, _tocEntry::section, SECTION_POST_DATA, _archiveHandle::tableDataId, _archiveHandle::toc, and _archiveHandle::tocsByDumpId.
Referenced by fix_dependencies().
|
static |
Definition at line 4016 of file pg_backup_archiver.c.
References ACT_RESTORE, Assert(), _tocEntry::desc, DispatchJobForTocEntry(), _tocEntry::dumpId, _parallelReadyList::first_te, IsEveryWorkerIdle(), _parallelReadyList::last_te, mark_restore_job_done(), move_to_ready_list(), pg_log_debug, pg_log_info, pop_next_work_item(), ready_list_free(), ready_list_init(), reduce_dependencies(), REQ_DATA, REQ_SCHEMA, _tocEntry::reqs, RESTORE_PASS_LAST, RESTORE_PASS_MAIN, _archiveHandle::restorePass, _tocEntry::tag, _archiveHandle::tocCount, WaitForWorkers(), WFW_GOT_STATUS, and WFW_ONE_IDLE.
Referenced by RestoreArchive().
|
static |
Definition at line 4132 of file pg_backup_archiver.c.
References _doSetFixedOutputState(), ConnectDatabase(), _restoreOptions::cparams, _tocEntry::desc, _tocEntry::dumpId, _tocEntry::pending_next, pg_log_debug, pg_log_info, _archiveHandle::public, restore_toc_entry(), Archive::ropt, and _tocEntry::tag.
Referenced by RestoreArchive().
|
static |
Definition at line 3901 of file pg_backup_archiver.c.
References _tocEntryRestorePass(), _archiveHandle::currSchema, _archiveHandle::currTableAm, _archiveHandle::currTablespace, _archiveHandle::currUser, _tocEntry::desc, DisconnectDatabase(), _tocEntry::dumpId, fix_dependencies(), free, _tocEntry::next, pending_list_append(), pg_log_debug, pg_log_info, _archiveHandle::public, reduce_dependencies(), RESTORE_PASS_MAIN, restore_toc_entry(), _archiveHandle::restorePass, _tocEntry::section, SECTION_DATA, SECTION_POST_DATA, SECTION_PRE_DATA, _tocEntry::tag, and _archiveHandle::toc.
Referenced by RestoreArchive().
|
static |
Definition at line 764 of file pg_backup_archiver.c.
References _becomeOwner(), _disableTriggersIfNecessary(), _enableTriggersIfNecessary(), _printTocEntry(), _reconnectToDB(), _selectOutputSchema(), ahprintf(), CommitTransaction(), _tocEntry::copyStmt, _tocEntry::created, _archiveHandle::currentTE, _restoreOptions::dataOnly, _tocEntry::defn, _tocEntry::desc, EndDBCopyMode(), fmtQualifiedId(), _tocEntry::hadDumper, inhibit_data_for_failed_table(), is_load_via_partition_root(), _archiveHandle::lastErrorTE, mark_create_done(), Archive::n_errors, _restoreOptions::noDataForFailedTables, OUTPUT_COPYDATA, OUTPUT_OTHERDATA, OUTPUT_SQLCMDS, _archiveHandle::outputKind, pg_log_info, pg_log_warning, _archiveHandle::PrintTocDataPtr, _archiveHandle::public, REQ_DATA, REQ_SCHEMA, _tocEntry::reqs, RestoringToDB(), Archive::ropt, StartTransaction(), _restoreOptions::suppressDumpWarnings, _tocEntry::tag, WORKER_CREATE_DONE, WORKER_IGNORED_ERRORS, WORKER_INHIBIT_DATA, and WORKER_OK.
Referenced by parallel_restore(), restore_toc_entries_postfork(), restore_toc_entries_prefork(), and RestoreArchive().
void RestoreArchive | ( | Archive * | AHX | ) |
Definition at line 349 of file pg_backup_archiver.c.