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 "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 | _outputContext |
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 _outputContext | OutputContext |
typedef struct _parallelReadyList | ParallelReadyList |
#define TEXT_DUMP_HEADER "--\n-- PostgreSQL database dump\n--\n\n" |
Definition at line 43 of file pg_backup_archiver.c.
#define TEXT_DUMPALL_HEADER "--\n-- PostgreSQL database cluster dump\n--\n\n" |
Definition at line 44 of file pg_backup_archiver.c.
typedef struct _outputContext OutputContext |
typedef struct _parallelReadyList ParallelReadyList |
|
static |
Definition at line 2202 of file pg_backup_archiver.c.
References _discoverArchiveFormat(), archCustom, archDirectory, _archiveHandle::archiveDumpVersion, archModeWrite, archNull, archTar, archUnknown, _archiveHandle::compression, _archiveHandle::createDate, _archiveHandle::currSchema, _archiveHandle::currTableAm, _archiveHandle::currTablespace, _archiveHandle::currUser, _archiveHandle::dosync, dosync, Archive::encoding, Archive::exit_on_error, fmt, _archiveHandle::format, _archiveHandle::fSpec, _archiveHandle::gzOut, InitArchiveFmt_Custom(), InitArchiveFmt_Directory(), InitArchiveFmt_Null(), InitArchiveFmt_Tar(), _archiveHandle::intSize, K_VERS_SELF, mode, _archiveHandle::mode, Archive::n_errors, _tocEntry::next, _archiveHandle::OF, _archiveHandle::offSize, 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 3232 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 3208 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 978 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 2061 of file pg_backup_archiver.c.
References archCustom, archDirectory, archTar, buf, _archiveHandle::format, free, _archiveHandle::fSpec, isValidTarHeader(), _archiveHandle::lookahead, _archiveHandle::lookaheadLen, _archiveHandle::lookaheadPos, _archiveHandle::lookaheadSize, MAXPGPATH, PG_BINARY_R, pg_fatal, pg_log_debug, pg_malloc0(), READ_ERROR_EXIT, _archiveHandle::readHeader, S_ISDIR, S_ISREG, sig, snprintf, stat::st_mode, stat, TEXT_DUMP_HEADER, and TEXT_DUMPALL_HEADER.
Referenced by _allocAH().
|
static |
Definition at line 3067 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 3120 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 1004 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 3413 of file pg_backup_archiver.c.
References appendPQExpBuffer(), appendPQExpBufferStr(), buf, _tocEntry::desc, _tocEntry::dropStmt, fmtId(), free, pg_log_warning, pg_strdup(), _tocEntry::tag, and generate_unaccent_rules::type.
Referenced by _printTocEntry().
Definition at line 1793 of file pg_backup_archiver.c.
References _tocEntry::next, and _tocEntry::prev.
Referenced by SortTocFromFile().
|
static |
Definition at line 3498 of file pg_backup_archiver.c.
References _becomeOwner(), _getObjectDescription(), _selectOutputSchema(), _selectTableAccessMethod(), _selectTablespace(), _tocEntryIsACL(), ahprintf(), appendPQExpBuffer(), appendPQExpBufferStr(), _tocEntry::catalogId, createPQExpBuffer(), _archiveHandle::currUser, PQExpBufferData::data, _tocEntry::defn, _tocEntry::dependencies, _tocEntry::desc, destroyPQExpBuffer(), _tocEntry::dropStmt, _tocEntry::dumpId, fmtId(), free, i, _tocEntry::nDeps, _restoreOptions::noOwner, _restoreOptions::noTablespace, _archiveHandle::noTocComments, CatalogId::oid, _tocEntry::owner, pg_log_warning, _archiveHandle::PrintExtraTocPtr, _archiveHandle::public, Archive::ropt, sanitize_line(), _tocEntry::tableam, CatalogId::tableoid, _tocEntry::tablespace, _tocEntry::tag, _restoreOptions::use_setsessauth, and Archive::verbose.
Referenced by restore_toc_entry().
|
static |
Definition at line 3163 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 3248 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 3361 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 3300 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 3052 of file pg_backup_archiver.c.
References _tocEntry::desc.
Referenced by _printTocEntry(), and _tocEntryRequired().
|
static |
Definition at line 2762 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 3019 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 1588 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(), _EndBlob(), _EndBlobs(), _EndData(), _PrintExtraToc(), _PrintTocData(), _printTocEntry(), _reconnectToDB(), _selectOutputSchema(), _selectTableAccessMethod(), _selectTablespace(), _StartBlob(), _StartBlobs(), _WriteBlobData(), DropBlobIfExists(), dump_lo_buf(), dumpTimestamp(), EndRestoreBlob(), EndRestoreBlobs(), PrintTOCSummary(), restore_toc_entry(), RestoreArchive(), StartRestoreBlob(), and StartRestoreBlobs().
void ahwrite | ( | const void * | ptr, |
size_t | size, | ||
size_t | nmemb, | ||
ArchiveHandle * | AH | ||
) |
Definition at line 1679 of file pg_backup_archiver.c.
References _archiveHandle::CustomOutPtr, dump_lo_buf(), ExecuteSqlCommandBuf(), _archiveHandle::gzOut, GZWRITE, _archiveHandle::lo_buf, _archiveHandle::lo_buf_size, _archiveHandle::lo_buf_used, _archiveHandle::OF, _archiveHandle::public, remaining, RestoringToDB(), WRITE_ERROR_EXIT, and _archiveHandle::writingBlob.
Referenced by _LoadBlobs(), _PrintFileData(), _PrintTocData(), _WriteData(), ahprintf(), and ReadDataFromArchiveNone().
TocEntry* ArchiveEntry | ( | Archive * | AHX, |
CatalogId | catalogId, | ||
DumpId | dumpId, | ||
ArchiveOpts * | opts | ||
) |
Definition at line 1056 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(), dumpBlob(), dumpCast(), dumpCollation(), dumpCommentExtended(), dumpCompositeType(), dumpCompositeTypeColComments(), dumpConstraint(), dumpConversion(), dumpDatabase(), dumpDefaultACL(), dumpDomain(), dumpDumpableObject(), dumpEncoding(), dumpEnumType(), dumpEventTrigger(), dumpExtension(), dumpForeignDataWrapper(), dumpForeignServer(), dumpFunc(), dumpIndex(), dumpIndexAttach(), 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 1450 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 1443 of file pg_backup_archiver.c.
References WriteData().
Referenced by dumpTableData_insert().
|
static |
Definition at line 1818 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 4782 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 264 of file pg_backup_archiver.c.
References _archiveHandle::ClosePtr, GZCLOSE, _archiveHandle::gzOut, _archiveHandle::OF, pg_fatal, res, and generate_unaccent_rules::stdout.
Referenced by main().
Archive* CreateArchive | ( | const char * | FileSpec, |
const ArchiveFormat | fmt, | ||
const int | compression, | ||
bool | dosync, | ||
ArchiveMode | mode, | ||
SetupWorkerPtrType | setupDumpWorker | ||
) |
Definition at line 241 of file pg_backup_archiver.c.
References _allocAH(), dosync, fmt, mode, and setupDumpWorker().
Referenced by main().
void DeCloneArchive | ( | ArchiveHandle * | AH | ) |
Definition at line 4832 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 1636 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::writingBlob.
Referenced by ahwrite(), and EndRestoreBlob().
DumpOptions* dumpOptionsFromRestoreOptions | ( | RestoreOptions * | ropt | ) |
Definition at line 177 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 1232 of file pg_backup_archiver.c.
References _archiveHandle::currToc, and _archiveHandle::EndBlobPtr.
Referenced by dumpBlobs().
void EndRestoreBlob | ( | ArchiveHandle * | AH, |
Oid | oid | ||
) |
Definition at line 1336 of file pg_backup_archiver.c.
References ahprintf(), _archiveHandle::connection, dump_lo_buf(), _archiveHandle::lo_buf_used, lo_close(), _archiveHandle::loFd, and _archiveHandle::writingBlob.
Referenced by _LoadBlobs().
void EndRestoreBlobs | ( | ArchiveHandle * | AH | ) |
Definition at line 1269 of file pg_backup_archiver.c.
References ahprintf(), _archiveHandle::blobCount, CommitTransaction(), _archiveHandle::connection, ngettext, pg_log_info, _archiveHandle::public, Archive::ropt, and _restoreOptions::single_txn.
Referenced by _LoadBlobs().
|
static |
Definition at line 4479 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 1859 of file pg_backup_archiver.c.
References buildTocEntryArrays(), and _archiveHandle::tocsByDumpId.
Referenced by _PrintTocData(), parseWorkerCommand(), SortTocFromFile(), and TocIDRequired().
Definition at line 4170 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 4643 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 4762 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 163 of file pg_backup_archiver.c.
References DUMP_UNSECTIONED, opts, and TRI_DEFAULT.
Referenced by main(), and NewDumpOptions().
|
static |
Definition at line 4747 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 2382 of file pg_backup_archiver.c.
References _tocEntry::desc, _tocEntry::dumpId, pg_fatal, pg_log_info, status(), and _tocEntry::tag.
Referenced by WriteDataChunks().
|
static |
Definition at line 4438 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(), status(), _tocEntry::tag, WORKER_CREATE_DONE, WORKER_IGNORED_ERRORS, and WORKER_INHIBIT_DATA.
Referenced by restore_toc_entries_parallel().
|
static |
Definition at line 4323 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 151 of file pg_backup_archiver.c.
References InitDumpOptions(), opts, and pg_malloc().
Referenced by dumpOptionsFromRestoreOptions().
RestoreOptions* NewRestoreOptions | ( | void | ) |
Definition at line 963 of file pg_backup_archiver.c.
References archUnknown, DUMP_UNSECTIONED, opts, pg_malloc0(), and TRI_DEFAULT.
Referenced by _CloseArchive(), and main().
Archive* OpenArchive | ( | const char * | FileSpec, |
const ArchiveFormat | fmt | ||
) |
Definition at line 255 of file pg_backup_archiver.c.
References _allocAH(), archModeRead, fmt, and setupRestoreWorker().
Referenced by main().
int parallel_restore | ( | ArchiveHandle * | AH, |
TocEntry * | te | ||
) |
Definition at line 4415 of file pg_backup_archiver.c.
References Assert(), _archiveHandle::connection, Archive::n_errors, _archiveHandle::public, restore_toc_entry(), and status().
Referenced by _WorkerJobRestoreCustom(), and _WorkerJobRestoreDirectory().
Definition at line 4202 of file pg_backup_archiver.c.
References _tocEntry::pending_next, and _tocEntry::pending_prev.
Referenced by restore_toc_entries_prefork().
|
static |
Definition at line 4195 of file pg_backup_archiver.c.
References _tocEntry::pending_next, and _tocEntry::pending_prev.
Referenced by RestoreArchive().
|
static |
Definition at line 4212 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 4358 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 1114 of file pg_backup_archiver.c.
References _tocEntryRequired(), ahprintf(), archCustom, _archiveHandle::archdbname, archDirectory, ARCHIVE_MAJOR, ARCHIVE_MINOR, ARCHIVE_REV, _archiveHandle::archiveDumpVersion, _archiveHandle::archiveRemoteVersion, archTar, _tocEntry::catalogId, _archiveHandle::compression, _archiveHandle::createDate, _tocEntry::dependencies, _tocEntry::desc, _tocEntry::dumpId, _restoreOptions::filename, _archiveHandle::format, free, i, _archiveHandle::intSize, _tocEntry::nDeps, _tocEntry::next, _archiveHandle::offSize, CatalogId::oid, _tocEntry::owner, 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 297 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 2658 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 2702 of file pg_backup_archiver.c.
References _tocEntry::defn, pg_strdup(), _archiveHandle::public, and Archive::searchpath.
Referenced by ReadToc().
|
static |
Definition at line 2686 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 3734 of file pg_backup_archiver.c.
References _archiveHandle::archdbname, _archiveHandle::archiveDumpVersion, _archiveHandle::archiveRemoteVersion, _archiveHandle::compression, _archiveHandle::createDate, fmt, _archiveHandle::format, _archiveHandle::intSize, K_VERS_1_0, K_VERS_1_10, K_VERS_1_2, K_VERS_1_4, K_VERS_1_7, K_VERS_MAX, MAKE_ARCHIVE_VERSION, _archiveHandle::offSize, pg_fatal, pg_log_warning, _archiveHandle::ReadBufPtr, _archiveHandle::ReadBytePtr, _archiveHandle::readHeader, ReadInt(), ReadStr(), tm, pg_tm::tm_sec, _archiveHandle::version, and Z_DEFAULT_COMPRESSION.
Referenced by InitArchiveFmt_Custom(), InitArchiveFmt_Directory(), and InitArchiveFmt_Tar().
int ReadInt | ( | ArchiveHandle * | AH | ) |
Definition at line 1995 of file pg_backup_archiver.c.
References b, _archiveHandle::intSize, K_VERS_1_0, _archiveHandle::ReadBytePtr, res, sign, and _archiveHandle::version.
Referenced by _CustomReadFunc(), _LoadBlobs(), _readBlockHeader(), _ReadExtraToc(), _skipBlobs(), _skipData(), ReadHead(), ReadOffset(), ReadStr(), and ReadToc().
int ReadOffset | ( | ArchiveHandle * | AH, |
pgoff_t * | o | ||
) |
Definition at line 1900 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 2041 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 2489 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 4238 of file pg_backup_archiver.c.
References pg_free(), and _parallelReadyList::tes.
Referenced by restore_toc_entries_parallel().
|
static |
Definition at line 4225 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 4245 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 4254 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 4278 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 4707 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 4609 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 4020 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 4136 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 758 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(), _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(), status(), _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 352 of file pg_backup_archiver.c.