PostgreSQL Source Code
git master
|
Go to the source code of this file.
Typedefs | |
typedef struct SnapBuild | SnapBuild |
Enumerations | |
enum | SnapBuildState { SNAPBUILD_START = -1 , SNAPBUILD_BUILDING_SNAPSHOT = 0 , SNAPBUILD_FULL_SNAPSHOT = 1 , SNAPBUILD_CONSISTENT = 2 } |
Definition at line 1 of file snapbuild.h.
enum SnapBuildState |
Enumerator | |
---|---|
SNAPBUILD_START | |
SNAPBUILD_BUILDING_SNAPSHOT | |
SNAPBUILD_FULL_SNAPSHOT | |
SNAPBUILD_CONSISTENT |
Definition at line 18 of file snapbuild.h.
SnapBuild* AllocateSnapshotBuilder | ( | struct ReorderBuffer * | reorder, |
TransactionId | xmin_horizon, | ||
XLogRecPtr | start_lsn, | ||
bool | need_full_snapshot, | ||
bool | in_slot_creation, | ||
XLogRecPtr | two_phase_at | ||
) |
Definition at line 324 of file snapbuild.c.
References ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, SnapBuild::building_full_snapshot, SnapBuild::catchange, SnapBuild::committed, SnapBuild::context, context, CurrentMemoryContext, SnapBuild::in_slot_creation, SnapBuild::includes_all_transactions, SnapBuild::initial_xmin_horizon, MemoryContextSwitchTo(), palloc0(), SnapBuild::reorder, SNAPBUILD_START, SnapBuild::start_decoding_at, SnapBuild::state, SnapBuild::two_phase_at, SnapBuild::xcnt, SnapBuild::xcnt_space, and SnapBuild::xip.
Referenced by StartupDecodingContext().
void CheckPointSnapBuild | ( | void | ) |
Definition at line 2074 of file snapbuild.c.
References AllocateDir(), dirent::d_name, DEBUG1, elog, ereport, errcode_for_file_access(), errmsg(), FreeDir(), get_dirent_type(), GetRedoRecPtr(), InvalidXLogRecPtr, LOG, MAXPGPATH, PG_LOGICAL_SNAPSHOTS_DIR, PGFILETYPE_ERROR, PGFILETYPE_REG, ReadDir(), ReplicationSlotsComputeLogicalRestartLSN(), and snprintf.
Referenced by CheckPointGuts().
void FreeSnapshotBuilder | ( | SnapBuild * | builder | ) |
Definition at line 372 of file snapbuild.c.
References SnapBuild::context, context, MemoryContextDelete(), SnapBuildSnapDecRefcount(), and SnapBuild::snapshot.
Referenced by FreeDecodingContext().
void SnapBuildClearExportedSnapshot | ( | void | ) |
Definition at line 739 of file snapbuild.c.
References AbortCurrentTransaction(), CurrentResourceOwner, elog, ERROR, ExportInProgress, IsTransactionState(), and SavedResourceOwnerDuringExport.
Referenced by exec_replication_command().
void SnapBuildCommitTxn | ( | SnapBuild * | builder, |
XLogRecPtr | lsn, | ||
TransactionId | xid, | ||
int | nsubxacts, | ||
TransactionId * | subxacts, | ||
uint32 | xinfo | ||
) |
Definition at line 1034 of file snapbuild.c.
References Assert, SnapBuild::building_full_snapshot, SnapBuild::committed, DEBUG1, DEBUG2, elog, SnapBuild::includes_all_transactions, SnapBuild::next_phase_at, NormalTransactionIdFollows, SnapBuild::reorder, ReorderBufferSetBaseSnapshot(), ReorderBufferXidHasBaseSnapshot(), SNAPBUILD_BUILDING_SNAPSHOT, SNAPBUILD_CONSISTENT, SNAPBUILD_FULL_SNAPSHOT, SNAPBUILD_START, SnapBuildAddCommittedTxn(), SnapBuildBuildSnapshot(), SnapBuildDistributeNewCatalogSnapshot(), SnapBuildSnapDecRefcount(), SnapBuildSnapIncRefcount(), SnapBuildXidHasCatalogChanges(), SnapBuild::snapshot, SnapBuild::start_decoding_at, SnapBuild::state, TransactionIdAdvance, TransactionIdFollowsOrEquals(), TransactionIdIsValid, TransactionIdPrecedes(), and SnapBuild::xmax.
Referenced by DecodeCommit().
SnapBuildState SnapBuildCurrentState | ( | SnapBuild * | builder | ) |
Definition at line 416 of file snapbuild.c.
References SnapBuild::state.
Referenced by DecodePrepare(), DecodingContextReady(), heap2_decode(), heap_decode(), logicalmsg_decode(), ReorderBufferCanStartStreaming(), and xact_decode().
const char* SnapBuildExportSnapshot | ( | SnapBuild * | builder | ) |
Definition at line 678 of file snapbuild.c.
References CurrentResourceOwner, elog, ereport, errmsg_plural(), ERROR, ExportInProgress, ExportSnapshot(), IsTransactionOrTransactionBlock(), LOG, SavedResourceOwnerDuringExport, SnapBuildInitialSnapshot(), StartTransactionCommand(), XACT_REPEATABLE_READ, XactIsoLevel, XactReadOnly, and SnapshotData::xcnt.
Referenced by CreateReplicationSlot().
Definition at line 718 of file snapbuild.c.
References Assert, SNAPBUILD_CONSISTENT, SnapBuildBuildSnapshot(), SnapBuildSnapIncRefcount(), SnapBuild::snapshot, and SnapBuild::state.
Referenced by logicalmsg_decode().
XLogRecPtr SnapBuildGetTwoPhaseAt | ( | SnapBuild * | builder | ) |
Definition at line 425 of file snapbuild.c.
References SnapBuild::two_phase_at.
Referenced by DecodeCommit().
Definition at line 579 of file snapbuild.c.
References Assert, SnapBuild::building_full_snapshot, SnapBuild::committed, elog, ereport, errcode(), ERRCODE_T_R_SERIALIZATION_FAILURE, errmsg(), ERROR, GetMaxSnapshotXidCount(), GetOldestSafeDecodingTransactionId(), HaveRegisteredOrActiveSnapshot(), HistoricSnapshotActive(), SnapBuild::includes_all_transactions, InvalidateCatalogSnapshot(), LW_SHARED, LWLockAcquire(), LWLockRelease(), MyProc, NormalTransactionIdPrecedes, palloc(), SNAPBUILD_CONSISTENT, SnapBuildBuildSnapshot(), SNAPSHOT_MVCC, SnapshotData::snapshot_type, SnapBuild::state, test(), TransactionIdAdvance, TransactionIdFollows(), TransactionIdIsValid, XACT_REPEATABLE_READ, XactIsoLevel, SnapshotData::xcnt, xidComparator(), SnapshotData::xip, SnapshotData::xmax, PGPROC::xmin, and SnapshotData::xmin.
Referenced by CreateReplicationSlot(), and SnapBuildExportSnapshot().
bool SnapBuildProcessChange | ( | SnapBuild * | builder, |
TransactionId | xid, | ||
XLogRecPtr | lsn | ||
) |
Definition at line 778 of file snapbuild.c.
References SnapBuild::next_phase_at, SnapBuild::reorder, ReorderBufferSetBaseSnapshot(), ReorderBufferXidHasBaseSnapshot(), SNAPBUILD_CONSISTENT, SNAPBUILD_FULL_SNAPSHOT, SnapBuildBuildSnapshot(), SnapBuildSnapIncRefcount(), SnapBuild::snapshot, SnapBuild::state, and TransactionIdPrecedes().
Referenced by heap2_decode(), heap_decode(), and logicalmsg_decode().
void SnapBuildProcessNewCid | ( | SnapBuild * | builder, |
TransactionId | xid, | ||
XLogRecPtr | lsn, | ||
struct xl_heap_new_cid * | xlrec | ||
) |
Definition at line 828 of file snapbuild.c.
References xl_heap_new_cid::cmax, xl_heap_new_cid::cmin, xl_heap_new_cid::combocid, elog, ERROR, InvalidCommandId, Max, SnapBuild::reorder, ReorderBufferAddNewCommandId(), ReorderBufferAddNewTupleCids(), ReorderBufferXidSetCatalogChanges(), xl_heap_new_cid::target_locator, xl_heap_new_cid::target_tid, and xl_heap_new_cid::top_xid.
Referenced by heap2_decode().
void SnapBuildProcessRunningXacts | ( | SnapBuild * | builder, |
XLogRecPtr | lsn, | ||
struct xl_running_xacts * | running | ||
) |
Definition at line 1227 of file snapbuild.c.
References ReorderBuffer::current_restart_decoding_lsn, DEBUG3, elog, InvalidTransactionId, InvalidXLogRecPtr, SnapBuild::last_serialized_snapshot, LogicalIncreaseRestartDecodingForSlot(), LogicalIncreaseXminForSlot(), xl_running_xacts::oldestRunningXid, SnapBuild::reorder, ReorderBufferGetOldestTXN(), ReorderBufferGetOldestXmin(), ReorderBufferTXN::restart_decoding_lsn, SNAPBUILD_CONSISTENT, SnapBuildFindSnapshot(), SnapBuildPurgeOlderTxn(), SnapBuildSerialize(), SnapBuild::state, SnapBuild::xmax, and SnapBuild::xmin.
Referenced by standby_decode().
void SnapBuildResetExportedSnapshotState | ( | void | ) |
Definition at line 766 of file snapbuild.c.
References ExportInProgress, and SavedResourceOwnerDuringExport.
Referenced by AbortTransaction().
void SnapBuildSerializationPoint | ( | SnapBuild * | builder, |
XLogRecPtr | lsn | ||
) |
Definition at line 1609 of file snapbuild.c.
References SNAPBUILD_CONSISTENT, SnapBuildRestore(), SnapBuildSerialize(), and SnapBuild::state.
Referenced by xlog_decode().
void SnapBuildSetTwoPhaseAt | ( | SnapBuild * | builder, |
XLogRecPtr | ptr | ||
) |
Definition at line 434 of file snapbuild.c.
References SnapBuild::two_phase_at.
Referenced by CreateDecodingContext().
void SnapBuildSnapDecRefcount | ( | Snapshot | snap | ) |
Definition at line 467 of file snapbuild.c.
References SnapshotData::active_count, Assert, SnapshotData::copied, SnapshotData::curcid, elog, ERROR, FirstCommandId, SnapshotData::regd_count, SnapBuildFreeSnapshot(), SNAPSHOT_HISTORIC_MVCC, SnapshotData::snapshot_type, SnapshotData::suboverflowed, and SnapshotData::takenDuringRecovery.
Referenced by FreeSnapshotBuilder(), ReorderBufferCleanupTXN(), ReorderBufferFreeSnap(), ReorderBufferTransferSnapToParent(), SnapBuildCommitTxn(), and SnapBuildRestore().
bool SnapBuildSnapshotExists | ( | XLogRecPtr | lsn | ) |
Definition at line 2162 of file snapbuild.c.
References ereport, errcode_for_file_access(), errmsg(), ERROR, LSN_FORMAT_ARGS, MAXPGPATH, PG_LOGICAL_SNAPSHOTS_DIR, sprintf, and stat.
Referenced by update_local_synced_slot().
bool SnapBuildXactNeedsSkip | ( | SnapBuild * | builder, |
XLogRecPtr | ptr | ||
) |
Definition at line 443 of file snapbuild.c.
References SnapBuild::start_decoding_at.
Referenced by AssertTXNLsnOrder(), DecodeTXNNeedSkip(), logicalmsg_decode(), and ReorderBufferCanStartStreaming().