PostgreSQL Source Code
git master
|
#include "common/compression.h"
#include "common/file_utils.h"
#include "fe_utils/simple_list.h"
#include "libpq-fe.h"
Go to the source code of this file.
Data Structures | |
struct | _connParams |
struct | _restoreOptions |
struct | _dumpOptions |
struct | Archive |
struct | CatalogId |
Macros | |
#define | InvalidDumpId 0 |
#define | appendStringLiteralAH(buf, str, AH) appendStringLiteral(buf, str, (AH)->encoding, (AH)->std_strings) |
Typedefs | |
typedef enum trivalue | trivalue |
typedef enum _archiveFormat | ArchiveFormat |
typedef enum _archiveMode | ArchiveMode |
typedef enum _teSection | teSection |
typedef struct _connParams | ConnParams |
typedef struct _restoreOptions | RestoreOptions |
typedef struct _dumpOptions | DumpOptions |
typedef struct Archive | Archive |
typedef int | DumpId |
typedef int(* | DataDumperPtr) (Archive *AH, const void *userArg) |
typedef void(* | SetupWorkerPtrType) (Archive *AH) |
Enumerations | |
enum | trivalue { TRI_DEFAULT , TRI_NO , TRI_YES , TRI_DEFAULT , TRI_NO , TRI_YES , TRI_DEFAULT , TRI_NO , TRI_YES , TRI_DEFAULT , TRI_NO , TRI_YES } |
enum | _archiveFormat { archUnknown = 0 , archCustom = 1 , archTar = 3 , archNull = 4 , archDirectory = 5 } |
enum | _archiveMode { archModeAppend , archModeWrite , archModeRead } |
enum | _teSection { SECTION_NONE = 1 , SECTION_PRE_DATA , SECTION_DATA , SECTION_POST_DATA } |
enum | _dumpPreparedQueries { PREPQUERY_DUMPAGG , PREPQUERY_DUMPBASETYPE , PREPQUERY_DUMPCOMPOSITETYPE , PREPQUERY_DUMPDOMAIN , PREPQUERY_DUMPENUMTYPE , PREPQUERY_DUMPFUNC , PREPQUERY_DUMPOPR , PREPQUERY_DUMPRANGETYPE , PREPQUERY_DUMPTABLEATTACH , PREPQUERY_GETCOLUMNACLS , PREPQUERY_GETDOMAINCONSTRAINTS , NUM_PREP_QUERIES } |
#define appendStringLiteralAH | ( | buf, | |
str, | |||
AH | |||
) | appendStringLiteral(buf, str, (AH)->encoding, (AH)->std_strings) |
Definition at line 332 of file pg_backup.h.
#define InvalidDumpId 0 |
Definition at line 272 of file pg_backup.h.
typedef enum _archiveFormat ArchiveFormat |
typedef enum _archiveMode ArchiveMode |
typedef struct _connParams ConnParams |
typedef int(* DataDumperPtr) (Archive *AH, const void *userArg) |
Definition at line 278 of file pg_backup.h.
typedef int DumpId |
Definition at line 270 of file pg_backup.h.
typedef struct _dumpOptions DumpOptions |
typedef struct _restoreOptions RestoreOptions |
typedef void(* SetupWorkerPtrType) (Archive *AH) |
Definition at line 280 of file pg_backup.h.
typedef enum _teSection teSection |
enum _archiveFormat |
Enumerator | |
---|---|
archUnknown | |
archCustom | |
archTar | |
archNull | |
archDirectory |
Definition at line 39 of file pg_backup.h.
enum _archiveMode |
Enumerator | |
---|---|
archModeAppend | |
archModeWrite | |
archModeRead |
Definition at line 48 of file pg_backup.h.
enum _dumpPreparedQueries |
Definition at line 64 of file pg_backup.h.
enum _teSection |
Enumerator | |
---|---|
SECTION_NONE | |
SECTION_PRE_DATA | |
SECTION_DATA | |
SECTION_POST_DATA |
Definition at line 55 of file pg_backup.h.
enum trivalue |
Enumerator | |
---|---|
TRI_DEFAULT | |
TRI_NO | |
TRI_YES | |
TRI_DEFAULT | |
TRI_NO | |
TRI_YES | |
TRI_DEFAULT | |
TRI_NO | |
TRI_YES | |
TRI_DEFAULT | |
TRI_NO | |
TRI_YES |
Definition at line 32 of file pg_backup.h.
int archprintf | ( | Archive * | AH, |
const char * | fmt, | ||
... | |||
) |
Referenced by dumpTableData_copy(), and dumpTableData_insert().
void archputs | ( | const char * | s, |
Archive * | AH | ||
) |
Definition at line 1610 of file pg_backup_archiver.c.
References WriteData().
Referenced by dumpTableData_insert().
void CloseArchive | ( | Archive * | AHX | ) |
Definition at line 252 of file pg_backup_archiver.c.
References _archiveHandle::ClosePtr, EndCompressFileHandle(), _archiveHandle::OF, and pg_fatal.
Referenced by main().
void ConnectDatabase | ( | Archive * | AHX, |
const ConnParams * | cparams, | ||
bool | isReconnect | ||
) |
Definition at line 110 of file pg_backup_db.c.
References _check_database_version(), ALWAYS_SECURE_SEARCH_PATH_SQL, Assert, _archiveHandle::connection, CONNECTION_BAD, _connParams::dbname, ExecuteSqlQueryForSingleRow(), free, i, lengthof, notice_processor(), _connParams::override_dbname, password, pg_fatal, pg_strdup(), _connParams::pghost, _connParams::pgport, PQclear(), PQconnectdbParams(), PQconnectionNeedsPassword(), PQconnectionUsedPassword(), PQerrorMessage(), PQfinish(), PQpass(), PQsetNoticeProcessor(), PQstatus(), progname, _connParams::promptPassword, _archiveHandle::savedPassword, set_archive_cancel_info(), simple_prompt(), TRI_NO, TRI_YES, _connParams::username, and values.
Referenced by CloneArchive(), main(), ReconnectToServer(), restore_toc_entries_postfork(), and RestoreArchive().
Archive* CreateArchive | ( | const char * | FileSpec, |
const ArchiveFormat | fmt, | ||
const pg_compress_specification | compression_spec, | ||
bool | dosync, | ||
ArchiveMode | mode, | ||
SetupWorkerPtrType | setupDumpWorker, | ||
DataDirSyncMethod | sync_method | ||
) |
Definition at line 221 of file pg_backup_archiver.c.
References _allocAH(), dosync, fmt, mode, setupDumpWorker(), and sync_method.
Referenced by main().
void DisconnectDatabase | ( | Archive * | AHX | ) |
Definition at line 225 of file pg_backup_db.c.
References _archiveHandle::connCancel, _archiveHandle::connection, PQcancel(), PQfinish(), PQTRANS_ACTIVE, PQtransactionStatus(), and set_archive_cancel_info().
Referenced by archive_close_connection(), restore_toc_entries_prefork(), RestoreArchive(), and RunWorker().
DumpOptions* dumpOptionsFromRestoreOptions | ( | RestoreOptions * | ropt | ) |
Definition at line 157 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().
Definition at line 1388 of file pg_backup_archiver.c.
References _archiveHandle::currToc, and _archiveHandle::EndLOPtr.
Referenced by dumpLOs().
Definition at line 254 of file pg_backup_db.c.
References _archiveHandle::connection.
void InitDumpOptions | ( | DumpOptions * | opts | ) |
Definition at line 143 of file pg_backup_archiver.c.
References DUMP_UNSECTIONED, opts, and TRI_DEFAULT.
Referenced by main(), and NewDumpOptions().
DumpOptions* NewDumpOptions | ( | void | ) |
Definition at line 131 of file pg_backup_archiver.c.
References InitDumpOptions(), opts, and pg_malloc().
Referenced by dumpOptionsFromRestoreOptions().
RestoreOptions* NewRestoreOptions | ( | void | ) |
Definition at line 1071 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 237 of file pg_backup_archiver.c.
References _allocAH(), pg_compress_specification::algorithm, archModeRead, DATA_DIR_SYNC_METHOD_FSYNC, fmt, PG_COMPRESSION_NONE, and setupRestoreWorker().
Referenced by main().
void PrintTOCSummary | ( | Archive * | AHX | ) |
Definition at line 1262 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, _tocEntry::reqs, 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 279 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().
void RestoreArchive | ( | Archive * | AHX | ) |
Definition at line 334 of file pg_backup_archiver.c.
References _becomeOwner(), _doSetFixedOutputState(), _selectOutputSchema(), _tocEntryRestorePass(), ahprintf(), pg_compress_specification::algorithm, appendPQExpBuffer(), appendPQExpBufferStr(), _archiveHandle::archiveDumpVersion, _archiveHandle::archiveRemoteVersion, Assert, buildTocEntryArrays(), _tocEntry::catalogId, _archiveHandle::ClonePtr, CommitTransaction(), _restoreOptions::compression_spec, _archiveHandle::compression_spec, ConnectDatabase(), _archiveHandle::connection, _restoreOptions::cparams, _archiveHandle::createDate, _restoreOptions::createDB, createPQExpBuffer(), _archiveHandle::currentTE, _archiveHandle::currSchema, PQExpBufferData::data, _restoreOptions::dataOnly, _tocEntry::desc, destroyPQExpBuffer(), DisconnectDatabase(), DropLOIfExists(), _restoreOptions::dropSchema, _tocEntry::dropStmt, dumpTimestamp(), errmsg(), _restoreOptions::filename, free, _tocEntry::hadDumper, _restoreOptions::if_exists, IssueCommandPerBlob(), K_VERS_1_3, K_VERS_1_8, Archive::maxRemoteVersion, Archive::minRemoteVersion, _tocEntry::next, _archiveHandle::noTocComments, Archive::numWorkers, CatalogId::oid, ParallelBackupEnd(), ParallelBackupStart(), pending_list_header_init(), PG_COMPRESSION_NONE, pg_fatal, pg_free(), pg_log_info, pg_log_warning, pg_strdup(), _archiveHandle::PrepParallelRestorePtr, _tocEntry::prev, _archiveHandle::PrintTocDataPtr, _archiveHandle::public, _archiveHandle::ReopenPtr, REQ_DATA, REQ_SCHEMA, _tocEntry::reqs, RESTORE_PASS_ACL, RESTORE_PASS_MAIN, RESTORE_PASS_POST_ACL, restore_toc_entries_parallel(), restore_toc_entries_postfork(), restore_toc_entries_prefork(), restore_toc_entry(), RestoreOutput(), Archive::ropt, SaveOutput(), SetOutput(), _restoreOptions::single_txn, snprintf, _archiveHandle::stage, STAGE_FINALIZING, STAGE_INITIALIZING, STAGE_PROCESSING, StartTransaction(), supports_compression(), _tocEntry::tag, _archiveHandle::toc, _archiveHandle::tocsByDumpId, _restoreOptions::txn_size, _archiveHandle::txnCount, _restoreOptions::useDB, Archive::verbose, and _archiveHandle::version.
Referenced by _CloseArchive(), and main().
void SetArchiveOptions | ( | Archive * | AH, |
DumpOptions * | dopt, | ||
RestoreOptions * | ropt | ||
) |
Definition at line 266 of file pg_backup_archiver.c.
References Archive::dopt, dumpOptionsFromRestoreOptions(), and Archive::ropt.
Referenced by _CloseArchive(), and main().
void SortTocFromFile | ( | Archive * | AHX | ) |
Definition at line 1529 of file pg_backup_archiver.c.
References _moveBefore(), StringInfoData::data, getTocEntryByDumpId(), _restoreOptions::idWanted, initStringInfo(), StringInfoData::len, _archiveHandle::maxDumpId, PG_BINARY_R, pg_fatal, pg_free(), pg_get_line_buf(), pg_log_warning, pg_malloc0(), _archiveHandle::public, Archive::ropt, _archiveHandle::toc, and _restoreOptions::tocFile.
Referenced by main().
Definition at line 1374 of file pg_backup_archiver.c.
References _archiveHandle::currToc, pg_fatal, and _archiveHandle::StartLOPtr.
Referenced by dumpLOs().
void WriteData | ( | Archive * | AHX, |
const void * | data, | ||
size_t | dLen | ||
) |
Definition at line 1182 of file pg_backup_archiver.c.
References _archiveHandle::currToc, data, pg_fatal, and _archiveHandle::WriteDataPtr.
Referenced by archprintf(), archputs(), dumpLOs(), and dumpTableData_copy().